我想要一个<div>
具有水平滚动的 id ,但问题是它必须是响应式的,而不是固定宽度。
html, body {margin: 0; padding: 0;}
#myWorkContent{
width:530px;
height:210px;
border: 13px solid #bed5cd;
overflow-x: scroll;
overflow-y: hidden;
white-space: nowrap;
}
#myWorkContent a {
display: inline-block;
vertical-align: middle;
}
#myWorkContent img {border: 0;}
<div id="myWorkContent">
<a href="assets/work/1.jpg"><img src="http://placekitten.com/200/200/" height="190"></a>
<a href="assets/work/2.jpg"><img src="http://placekitten.com/120/120/"/></a>
<a href="assets/work/3.jpg"><img src="http://placekitten.com/90/90/" height="90" width="90"></a>
<a href="assets/work/4.jpg"><img src="http://placekitten.com/50/50/" height="190"></a>
<a href="assets/work/5.jpg"><img src="http://placekitten.com/100/100/"></a>
<a href="assets/work/6.jpg"><img src="http://placekitten.com/200/200/" height="190"></a>
</div><!-- end myWorkContent -->
感谢http://jsfiddle.net/clairesuzy/FPBWr/
问题在于那个 530px。我想用 100% 代替。但是后来我得到了页面滚动并且DIV的滚动正确,无法理解,知道吗?
这是关于解决方案的塞尔维亚语文章 http://www.blog.play2web.com/index.php?id=18