如何让我的两个并排高度相同?

时间:2014-07-20 13:40:25

标签: html css

My code @ JSFiddle

code that is needed
for linking JSFiddle
links
I don't understand why I need
this.

An image of the two divs, their the gray boxes.

如何让这两个div的高度相同?我不想做填充底部:px;和margin-bottom:-px;这似乎真的像作弊,只是操纵。

1 个答案:

答案 0 :(得分:1)

您可以使用display:tabledisplay:table-cell

#who-is {
    width: auto;
    display: table;
}

#left {
    width: 40%;
    padding: 5%;
    text-align: center;
    background: #CCC;
    display: table-cell;
}

#left h1 {
    font-size: 72px;
    text-transform: uppercase;
}

#right {
    width: 40%;
    padding: 5%;
    background: #eee;
    display: table-cell;
}

#right p {
    font-size: 16px;
}

fiddle