在示例代码中,如何通过将div替换为div来删除table,td和tr标记的使用以实现相同的行为?这些行为包括:
此代码的JSFiddle可以在http://jsfiddle.net/LwXhE/337/找到。
以下是示例代码:
.container {
width: 100%;
border: 1px solid black;
}
.column1 {
width: 65%;
border: 1px solid green;
vertical-align: top;
}
.column2 {
width: 35%;
border: 1px solid red;
vertical-align: top;
}
.content2 {
width: 120px;
border: 1px solid orange;
}

<table class="container">
<tbody>
<tr>
<td class="column1">
<div class="content1">I am content I am content I am content I am content</div>
</td>
<td class="column2">
<div>
<div class="content2">Hello Hello</div>
</div>
</td>
</tr>
</tbody>
</table>
&#13;
答案 0 :(得分:1)
您可以使用CSS表模型:
.container {
width: 100%;
border: 1px solid black;
display: table;
}
.column1, .column2 {
display: table-cell;
}
.column1 {
width: 65%;
border: 1px solid green;
vertical-align: top;
}
.column2 {
width: 35%;
border: 1px solid red;
vertical-align: top;
}
.content2 {
width: 120px;
border: 1px solid orange;
}
&#13;
<div class="container">
<div class="column1">
<div class="content1">I am content I am content I am content I am content</div>
</div>
<div class="column2">
<div class="content2">Hello Hello</div>
</div>
</div>
&#13;