Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align td elements in center [duplicate]

I have created a simple table and want to align the td elements in center but align:center in css doesn't seem to work

.cTable td{ align:center; }  <table border='1' id='mytable' class="cTable"> <tbody> <tr><th>Claim ID</th><th>Status</th></tr>  <tr><td align="center">22</td><td>333</td></tr>     <tr><td>22</td><td>333</td></tr> <tr><td>22</td><td>333</td></tr> </tbody> </table>  
like image 901
user1184100 Avatar asked May 20 '12 17:05

user1184100


People also ask

How do you align elements to the center?

Center Align Text To just center the text inside an element, use text-align: center; This text is centered.


2 Answers

It should be text-align, not align

https://developer.mozilla.org/en/CSS/text-align

like image 66
Ja͢ck Avatar answered Sep 29 '22 00:09

Ja͢ck


What worked for me is the following (in view of the confusion in other answers):

<td style="text-align:center;">     <input type="radio" name="ageneral" value="male"> </td> 

The proposed solution (text-align) works but must be used in a style attribute.

like image 29
GuruMatics Avatar answered Sep 29 '22 01:09

GuruMatics