三列始终具有相同的动态内容大小

时间:2012-04-25 09:54:56

标签: css html height

我有三个带动态内容的div,我需要三个div的高度始终相同。 三个div的代码是:

<div class="boxcontent3">
    <div class="whitebox3">
        <div class="whiteboxdemocont">
            conten1
        </div>
    </div>
    <div class="whitebox3">
        <div class="whiteboxdemocont">
            content2
        </div>
    </div>
    <div class="whitebox3">
        <div class="whiteboxdemocont">
            content3
        </div>
    </div>
</div>

和css风格:

.boxcontent3 {
    display: inline-block; 
    width: 100%;
}
.whitebox3 {
    float:left;
    background-color: white;
    border: 1px solid #dfe0e2; 
    -webkit-border-radius: 6px; /* Saf3-4, iOS 1-3.2, Android ≤1.6 */
    -moz-border-radius: 6px; /* FF1-3.6 */
    border-radius: 6px; /* Opera 10.5, IE9, Saf5, Chrome, FF4, iOS 4, Android 2.1+ */
    margin-top: 20px;
    margin-right: 10px;
    margin-bottom: 20px;
    width: 32%;
    height: 100%;
}

感谢

1 个答案:

答案 0 :(得分:1)

嘿,我认为你使用了像这样的显示表属性

<强>的CSS

.boxcontent3{
   display: table; 
   width: 100%;
}
.whitebox3{
display:table-cell;
background-color: white;
border: 1px solid #dfe0e2; 
-webkit-border-radius: 6px; /* Saf3-4, iOS 1-3.2, Android ≤1.6 */
-moz-border-radius: 6px; /* FF1-3.6 */
border-radius: 6px; /* Opera 10.5, IE9, Saf5, Chrome, FF4, iOS 4, Android 2.1+ */
margin-top: 20px;
margin-right: 10px;
margin-bottom: 20px;
width: 32%;
height: 100%;
}​

现场演示http://jsfiddle.net/dNmLh/