我有一个包含内包装的包装器,内包装器包含2个浮动div.左边的内容比右边的内容多,所以它的高度大于右边的高度.我要找的是两个容器都有相同的高度.
我的HTML:
<div id="wrapper">
<div id="sub-menu">
<div id="left-column" class="column">
Agenda</br>
Here I put some texte
</div>
<div id="right-column" class="column">
sdfdsf
</div>
</div>
</div>?
Run Code Online (Sandbox Code Playgroud)
我的css:
body{
background-color:#E5E5E5;}
#wrapper{
background-color:#FFFFFF;
width:800px;
margin-left:auto;
margin-right:auto;
overflow:auto;}
#sub-menu{
margin:10px;
width:780px;
position:relative;
float:left;}
.column{
float:left;
height:100%;}
#left-column{
width:500px;
background-color:yellow;}
#right-column{
width:280px;
background-color:magenta;}
Run Code Online (Sandbox Code Playgroud)
小智 6
除非你能保证每列的高度(你通常不能,使用像网一样的流体介质),你不能单独使用CSS来使用浮动元素.但是,你有选择:
display: table-cell:http://jsfiddle.net/8LdQk/3/.不幸的是,这在IE6或7中不起作用.这篇博文详细介绍了它的使用可能会有所帮助.| 归档时间: |
|
| 查看次数: |
4370 次 |
| 最近记录: |