以超文本和中央支助事务制作一个定期表格,对于刚刚在的人来说是一项困难的任务。 解决办法需要加固的表格:管理定期表格的外表,在外表的每个电池中,外表是内部的(封顶的)表格,以管理该要素的布局。
The inner tables require three rows and two columns. The second and third rows each contain a cell which spans both columns.
<table>
<tr>
<td class="numeroatomico">19</td>
<td class="massa">39,098</td>
</tr>
<tr>
<td class="symbol" colspan="2">K</td>
</tr>
<tr>
<td class="nome" colspan="2">Potassium</td>
</tr>
</table>
table {
border: 1px solid #888;
width: 6em;
}
td {
border: 1px solid red;
}
.numeroatomico {
font-weight: bold;
}
.massa {
font-size: 0.75em;
text-align: right;
}
.symbol {
font-size: 2em;
text-align: center;
}
.nome {
text-align: center;
}
<table>
<tr>
<td class="numeroatomico">19</td>
<td class="massa">39,098</td>
</tr>
<tr>
<td class="symbol" colspan="2">K</td>
</tr>
<tr>
<td class="nome" colspan="2">Potassium</td>
</tr>
</table>
然后,你需要一个外表来管理整个事情。 一开始:
.periodic {
border-collapse: collapse;
}
.periodic > tbody > tr > td {
width: 6em;
}
.periodic > tbody > tr > td:not(.empty) {
border: 1px solid black;
}
.periodic > tbody > tr > td >table {
width: 100%;
}
.numeroatomico {
font-weight: bold;
}
.massa {
font-size: 0.75em;
text-align: right;
}
.symbol {
font-size: 2em;
text-align: center;
}
.nome {
text-align: center;
}
.alkali-metal {
background: pink;
}
.alkali-earth-metal {
background: lavender;
}
.transition-metal {
background: aliceblue;
}
<table class="periodic">
<tr>
<td class="alkali-metal">
<table>
<tr>
<td class="numeroatomico">11</td>
<td class="massa">22,989</td>
</tr>
<tr>
<td class="symbol" colspan="2">Na</td>
</tr>
<tr>
<td class="nome" colspan="2">Sodium</td>
</tr>
</table>
</td>
<td class="alkali-earth-metal">
<table>
<tr>
<td class="numeroatomico">12</td>
<td class="massa">24,305</td>
</tr>
<tr>
<td class="symbol" colspan="2">Mg</td>
</tr>
<tr>
<td class="nome" colspan="2">Magnesium</td>
</tr>
</table>
</td>
<td class="empty"></td>
</tr>
<tr>
<td class="alkali-metal">
<table>
<tr>
<td class="numeroatomico">19</td>
<td class="massa">39,098</td>
</tr>
<tr>
<td class="symbol" colspan="2">K</td>
</tr>
<tr>
<td class="nome" colspan="2">Potassium</td>
</tr>
</table>
</td>
<td class="alkali-earth-metal">
<table>
<tr>
<td class="numeroatomico">20</td>
<td class="massa">40,08</td>
</tr>
<tr>
<td class="symbol" colspan="2">Ca</td>
</tr>
<tr>
<td class="nome" colspan="2">Calcium</td>
</tr>
</table>
</td>
<td class="transition-metal">
<table>
<tr>
<td class="numeroatomico">21</td>
<td class="massa">44,956</td>
</tr>
<tr>
<td class="symbol" colspan="2">Sc</td>
</tr>
<tr>
<td class="nome" colspan="2">Scandium</td>
</tr>
</table>
</td>
</tr>
</table>