4 回答

TA贡献1785条经验 获得超4个赞
您可以使用CSS表,而不是使用标记中的表。
标记
<body>
<div>hello </div>
<div>there</div>
</body>
(相关)CSS
body
{
display:table;
width:100%;
}
div
{
display:table-row;
}
div+ div
{
height:100%;
}
这种方法的一些优点是:
1)减少标记
2)标记比表更具语义,因为这不是表格数据。
3)浏览器支持非常好:IE8 +,所有现代浏览器和移动设备(caniuse)
为了完整起见,这里是CSS表模型的等效Html元素到css属性
table { display: table }
tr { display: table-row }
thead { display: table-header-group }
tbody { display: table-row-group }
tfoot { display: table-footer-group }
col { display: table-column }
colgroup { display: table-column-group }
td, th { display: table-cell }
caption { display: table-caption }
- 4 回答
- 0 关注
- 4179 浏览
相关问题推荐
添加回答
举报