Tue, 2014-09-30 13:39
Please help me.
How can I vertical align my text to the center in a table cell?
http://online-marketing-bedrijf.be/DWnieuw/diensten/website-designer.html
I have tried everything and it does not work (
.tableWebsiteDesigner{
display: table;
}
.tableWebsiteDesigner tr td{
vertical-align: middle;
display: table-cell;
}
Tue, 2014-09-30 15:01
#1
Padding
You have bottom padding on td. Since table elements try to shrink-wrap their content, the content is squeezed in with 1em at the bottom that makes it look as if vertical align is set to top.
Remove the bottom padding, and set height to some sane value. I tested at 2.5em, which seems reasonable.
You have used the wrong tags on the headers. Instead of
<td valign="middle" class="tableHeader"> ... </td>
<th> ... </th>
cheers,
gary