有三列..所有三列的组合宽度是固定的..第二列(中心)将具有动态内容..我需要左右列来相等地填充剩余空间(容器宽度 - 中心列动态宽度)。
例子:http://jsfiddle.net/htKje/
<div class="container">
<div class="bg"></div>
<div>Lorem Ipsum</div>
<div class="bg"></div>
</div>
CSS :
.container { width:500px; }
.bg {backgrould:#CCC; }
如果您只需要左列和右列来设置背景,那么很可能您根本不需要它们。
只需设置background
on the .container
,给同一个容器text-align: center
,制作中心柱inline-block
并重置background
and text-align
就可以了。
demo
HTML:
<div class='container'>
<div class='c'>booooo add remove text here</div>
</div>
CSS:
.container {
background: #ccc;
text-align: center;
}
.c {
display: inline-block;
background: white;
text-align: left;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)