我有内联 block div,但是当它们到达屏幕末尾时,它们会转到下一行而不是水平滚动,有人可以帮我吗? 这是一个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;
}
最佳答案
在 dx
类上使用 white-space: nowrap;
。
.dx{
width:100%;
height:100px;
overflow:scroll;
white-space: nowrap;
}
关于html - 内联 block 元素的水平滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23235016/