本文介绍了内联块元素的水平滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有内嵌块的div,但是当他们到达屏幕的尽头时,他们会走下一行而不是水平滚动,有人能帮我解决吗?
这里是
使用 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.
.dx{ width:100%; height:100px; overflow:scroll; white-space: nowrap; }
这篇关于内联块元素的水平滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!