I am using an HTML <table> and I want to align the text of <td> to the center in each cell.
<table>
<td>
How do I center align the text horizontally and vertically?
Here is an example with CSS and inline style attributes:
style
td { height: 50px; width: 50px; } #cssTable td { text-align: center; vertical-align: middle; }
<table border="1"> <tr> <td style="text-align: center; vertical-align: middle;">Text</td> <td style="text-align: center; vertical-align: middle;">Text</td> </tr> </table> <table border="1" id="cssTable"> <tr> <td>Text</td> <td>Text</td> </tr> </table>
1.4m articles
1.4m replys
5 comments
57.0k users