How to apply text-align left in the first column and text-align right in the others

You might want to look at the :first-child pseudo-class (W3C definition) – this is exactly the kind of thing it was designed for. You could use it like this:

.table td {
    text-align: right;
}

.table td:first-child {
    text-align: left;
}​

The :first-child pseudo-class means the selector only matches the first <td> in each <tr>.

Example here: http://jsfiddle.net/xv5Cn/1/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)