【发布时间】:2014-06-13 16:18:55
【问题描述】:
#container {
position:absolute;
top:0;
left:0;
width: 100%;
margin-left: 50px;
background: black;
color:white;
}
#sidebar {
width: 50px;
position: absolute;
top: 0;
left: 0;
background: blue;
color: white;
}
我希望 DIV 为width:100%,但左边距为 50px,但不将 div 推到另一端 50px 并启用水平滚动。
我知道使用 jQuery 可以做到这一点:
$('#container').width( $(window).width() - 50 );
但如果可能的话,我只追求 CSS 解决方案。
【问题讨论】: