内联块元素的水平滚动

编程入门 行业动态 更新时间:2024-10-28 15:23:04
本文介绍了内联块元素的水平滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有内嵌块的div,但是当他们到达屏幕的尽头时,他们会走下一行而不是水平滚动,有人能帮我解决吗? 这里是小提琴

< div class =m_wrap> < div class =dx> < div class =xc> 1< / div> < div class =xc> 2< / div> < div class =xc> 3< / div> < div class =xc> 4< / div> < div class =xc> 5< / div> < div class =xc> 6< / div> < div class =xc> 7< / div> < div class =xc> 8< / div> < div class =xc> 9< / div> < div class =xc> 10< / div> < / div> < / div>

css

.m_wrap { width:100%; height:100px; } .dx { width:100%; height:100px; overflow:scroll; } .xc { display:inline-block; width:100px; height:80px; border:1px solid; line-height:80px; text-align:center; margin-bottom:4px;

解决方案使用 white-space:nowrap; 在 dx class。

小提琴

。 dx { width:100%; height:100px; overflow:scroll; white-space:nowrap; }

I have inline-block divs however when they reach end of the screen, they go the next line instead of scrolling horizontally, can someone help me out? here is a fiddle

<div class="m_wrap"> <div class="dx"> <div class="xc">1</div> <div class="xc">2</div> <div class="xc">3</div> <div class="xc">4</div> <div class="xc">5</div> <div class="xc">6</div> <div class="xc">7</div> <div class="xc">8</div> <div class="xc">9</div> <div class="xc">10</div> </div> </div>

css

.m_wrap{ width:100%; height:100px; } .dx{ width:100%; height:100px; overflow:scroll; } .xc{ display:inline-block; width:100px; height:80px; border:1px solid; line-height:80px; text-align:center; margin-bottom:4px; }

解决方案

Use white-space: nowrap; on dx class.

Fiddle

.dx{ width:100%; height:100px; overflow:scroll; white-space: nowrap; }

更多推荐

内联块元素的水平滚动

本文发布于:2023-10-07 22:20:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1470677.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内联   元素   水平

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!