+ 2
When i make tables using HTML, how do i make all the contents of the table be centered without using align attribute ?
Instead of using align attributes again and again in between the <td> tag, how am i suppose to center all the contents ..that i am going insert in my table created using HTML 5
3 Respostas
+ 1
Use css ('align' html attribute is deprecated in all cases) and target <td> elements (all or specific to some <table>s):
<table id="myTab"> <!-- table content --> </table>
#myTab td { // target all <td>s descendant (childs) of element with id 'myTab'...
text-align:center;
}
0
<body>
<table style="vertical-align: middle; ">
<center>
<tr>
<td>...</td>
<td>...</td>
</tr>
</center>
</table>
</body>
- 2
Horizontally align? Just use:
text-align: center
in the div or in body (if you center everything on the page)