我是網絡編程的新手,我正在研究的網頁的第一稿中有一張表格。當我做了更多的閱讀時,我發現將外部表格作爲div渲染並將表格嵌套到外部div的單元格中會更好。然而,只要我切換我的表格標籤div divs停止顯示。我確定我錯過了一些明顯的東西。下面是代碼:表格表示爲Divs不顯示
CSS:
.Dashboard
{
display: table;
table-layout: fixed;
height: 500px;
width: 500px;
}
.col
{
display: table-column;
}
.cell1
{
display: table-cell;
border: 1px solid black;
}
.cell2
{
display: table-cell;
border: 1px solid black;
}
.cell3
{
display: table-cell;
border: 1px solid black;
}
.cell4
{
display: table-cell;
border: 1px solid black;
}
table.inner, td
{
border-collapse: collapse;
border: 2px solid black;
text-align: center;
padding: 2px;
}
td.image
{
padding: 0;
margin: 0;
}
HTML:
<form id="form1" runat="server">
<asp:Label runat="server" ID="label"></asp:Label>
<div runat="server" id="Dashboard" class="Dashboard">
<div class="col">
<div class="cell1">
<table class="inner" id="t1">
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr><...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
</table>
</div>
<div class="cell2">
<table class="inner" id="t2">
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
</table>
</div>
</div>
<div class="col">
<div class="cell3">
<table class="inner" id="t3">
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
</table>
</div>
<div class="cell4">
<table class="inner" id="t4">
<tr>...</tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
我實現所有的細胞都是一樣的時刻,但會改變 - 因此,四個不同的CSS規範。
任何意見表示讚賞。
問候。
不要將div和表格放在表單中! – poepje