Reputation: 2812
I have a table with 3 columns. I want that the third column is aligned to the right of the upper element and the other 2 columns to the left, like this:
(left column) (middle column) (right column)
Is there a way to do this via CSS or something?
Upvotes: 18
Views: 59964
Reputation: 20102
There are a few ways to do what you want. The most basic is to change the alignment directly in the tag
<td align='left'>data1</td><td align='right'>data1</td><td align='left'>data1</td>
<td align='left'>data2</td><td align='right'>data2</td><td align='left'>data2</td>
....
If you need to change something else (CSS style) you could create a class like .firstColumn
and .secondColumn
on each <td>
.
I tried to change directly the column, but that doesn't work (HTML table colgroup element is not working).
Upvotes: 5