HTML:
<div id="parent">
<div id="child">
<ul>
<li>one</li>
<li>A very long name. A very long name. A very long name. A very long name. A very long name. A very long name. </li>
<li>Three</li>
</ul>
</div>
</div>
CSS:
#parent {width:170px; border:1px solid #000; padding:20px}
#child {border:1px solid #F00}
我没有将宽度属性应用于子div。我想要的是在父div上看到水平和垂直滚动条。
小提琴:http://jsfiddle.net/NanzR/
预期产量:
答案 0 :(得分:4)
以下是一个例子:
#parent {
width:170px;
overflow: scroll;
height: 170px;
}
#child {
overflow: hidden;
display: inline-block;
min-width: 100%;
}