I am new to web programming and my first draft of a web page I am working on had tables within a table. As I did more reading I discovered that it is better style to render the outer table as a div and nest the tables in cells of the outer div. However, as soon as I switched my table tags to divs everything stopped displaying. I'm sure I am missing something obvious. Here is the code:
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>
I realize all the cells are the same at the moment but that will change -- hence the four different CSS specifications.
Any advice is appreciated.