我想将基于css表格的行的宽度扩展为100%的浏览器宽度,而不会破坏其余内容的布局。请注意,即使绿色标题栏已设置为100%宽度,它仍未扩展为全角。基于CSS表格的布局行未扩展100%宽度
我的代码可以在这里找到: http://codepen.io/anon/pen/HfnFv
CSS
html,body{
overflow:visible;
height:100%;padding:0;margin:0;
}
.header{background:green;position:absolute;}
.table{
display:table;
width:100%;
position:relative;
min-height:100%;
}
.trow{
display:table-row;
width:100%;
}
.left{
width:30%;
height:100%;
background-color:#990000;
color:#efefef;
display:table-cell;
}
.left p{
margin:100px 0;
}
.right{
width:70%;
height:100%;
background-color:blue;
color:#efefef;
display:table-cell;
}
HTML
<div class="table">
<div class="trow header">
<p>
test
</p>
</div>
<div class="trow">
<div class="left">
<p>
test
</p>
</div>
<div class="right">
test
</div>
</div>
</div>
UPDATE
增加
position:absolute;
标题行。
但我很想看到一个替代解决方案,它不会绝对定位子元素。
它似乎是工作给我 – RossBille
补充的位置是:绝对于行,但如果可能的话,希望看到一些替代方法即 – AntonB
将相关代码放在问题本身中。请尽量更好地解释您的问题 –