【发布时间】:2016-05-25 08:13:56
【问题描述】:
我有两个 div。外部 div 的名称是 scroll_main ,内部 div 是 scroll_holder 。外部 div 的宽度为 750 像素,溢出设置为自动。在内部 div 中,我添加了一些具有固定宽度和高度的 div,并向左浮动。所以我想使内部 div 的宽度自动,以便内部部分的所有包含 div 显示在一行中。我想从左向右滚动。可能吗?谢谢
这里是html
<div class="scroll_main">
<div class="scroll_holder">
<div style="width:400px; height:400px; background:#333; float:left; margin:10px"></div>
<div style="width:400px; height:400px; background:#999; float:left;margin:10px"></div>
<div style="width:400px; height:400px; background:#ccc; float:left;margin:10px"></div>
<div style="width:400px; height:400px; background:#22b1b5; float:left;margin:10px"></div>
<div style="width:400px; height:400px; background:#333; float:left; margin:10px"></div>
<div style="width:400px; height:400px; background:#999; float:left;margin:10px"></div>
</div>
</div>
这是我尝试应用的 css
.scroll_main {
height: 450px;
margin: 0 auto;
max-width: 97%;
overflow: auto;
position:relative;
width:750px
}
.scroll_holder{overflow:hidden; margin:5px; width:750px; overflow:auto }
【问题讨论】: