I use this construction to get table with square cells:
table {
width: 100%;
table-layout: fixed;
}
td {
text-align: center;
vertical-align: middle;
}
td:before {
content: '';
padding-top: 100%;
float: left;
}
But vertical-align doesn't work for cell's content. How can I fix that?
html is:
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
Replace
float: left;
with
display: inline-block;
vertical-align: middle;