4 回答

TA貢獻1785條經(jīng)驗 獲得超4個贊
您可以使用CSS表,而不是使用標記中的表。
標記
<body>
<div>hello </div>
<div>there</div>
</body>
(相關(guān))CSS
body
{
display:table;
width:100%;
}
div
{
display:table-row;
}
div+ div
{
height:100%;
}
這種方法的一些優(yōu)點是:
1)減少標記
2)標記比表更具語義,因為這不是表格數(shù)據(jù)。
3)瀏覽器支持非常好:IE8 +,所有現(xiàn)代瀏覽器和移動設(shè)備(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 }
添加回答
舉報