+ 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

4th Jul 2017, 6:11 PM
Pema Gyalpo
Pema Gyalpo - avatar
3 ответов
+ 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; }
5th Jul 2017, 3:45 AM
visph
visph - avatar
0
<body> <table style="vertical-align: middle; "> <center> <tr> <td>...</td> <td>...</td> </tr> </center> </table> </body>
4th Jul 2017, 7:08 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
- 2
Horizontally align? Just use: text-align: center in the div or in body (if you center everything on the page)
4th Jul 2017, 6:31 PM
Maart
Maart - avatar