<div class="aa_htmlTable">
<h2 class="aa_h2">HTML Table</h2>
<table>
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
</table>
</div>
<div class="aa_css">
<h2 class="aa_h2">CSS Table</h2>
<div class="table">
<div class="thead">
<div class="tr">
<div class="th">.table > .thead > .tr > .th</div>
<div class="th">.table > .thead > .tr > .th</div>
</div>
</div>
<div class="tbody">
<div class="tr">
<div class="td">
.table > .tbody > .tr > .td
</div>
<div class="td">
.table > .tbody > .tr > .td
</div>
</div>
<div class="tr">
<div class="td">
.table > .tbody > .tr > .td
</div>
<div class="td">
.table > .tbody > .tr > .td
</div>
</div>
</div>
<div class="tfoot">
<div class="tr">
<div class="td">
.table > .tfoot > .tr > .td
</div>
<div class="td">
.table > .tfoot > .tr > .td
</div>
</div>
</div>
</div>
<div class="ahmadawais">
Developed by <a href="http://AhmadAwais.com/about" target="_top">Ahmad Awais</a> - Open Source Engineer & Dev Advocate
</div>
</div>
<!-- Follow me on Twitter -->
<a class="twitter" target="_top" href="https://twitter.com/MrAhmadAwais"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
body {
display: table;
width: 100%;
background: #dedede;
text-align: center;
}
* {
box-sizing: border-box; /* Safari/Chrome, other WebKit */
box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
}
.aa_h2 {
font: 100 5rem/1 Roboto;
text-transform: uppercase;
}
table {
background: #fff;
}
table,
thead,
tbody,
tfoot,
tr,
td,
th {
text-align: center;
margin: auto;
border: 1px solid #dedede;
padding: 1rem;
width: 50%;
}
.table {
display: table;
width: 50%;
}
.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;
width: 50%;
}
.caption {
display: table-caption;
}
.table,
.thead,
.tbody,
.tfoot,
.tr,
.td,
.th {
text-align: center;
margin: auto;
padding: 1rem;
}
.table {
background: #fff;
margin: auto;
border: none;
padding: 0;
margin-bottom: 5rem;
}
.th {
font-weight: 700;
border: 1px solid #dedede;
&:nth-child(odd) {
border-right: none;
}
}
.td {
font-weight: 300;
border: 1px solid #dedede;
border-top: none;
&:nth-child(odd) {
border-right: none;
}
}
.aa_htmlTable {
background: tomato;
padding: 5rem;
display: table;
width: 100%;
height: 100vh;
vertical-align: middle;
}
.aa_css {
background: skyblue;
padding: 5rem;
display: table;
width: 100%;
height: 100vh;
vertical-align: middle;
}
.ahmadawais {
display: table;
width: 100%;
font: 100 1.2rem/2 Roboto;
margin: 5rem auto;
}
// [IGNORE] DEMO CSS BELOW.
.twitter {
position: fixed;
display: block;
right: 12px;
bottom: 12px;
svg {
width: 32px;
height: 32px;
fill: #1da1f2;
}
}
View Compiled
This Pen doesn't use any external JavaScript resources.