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?
HTML | <col> align Attribute left: It sets the text left-align. right: It sets the text right-align. center: It sets the text center-align.
Use width:100% on the table and the middle column. You could also set width:100% on the last column's style and td align="right" on the last column. Then you can insert more columns in the middle while the spacing still works.
Set a to zero and b to the position of the column in the table, e.g. td:nth-child(2) { text-align: right; } to right-align the second column. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n] , though this is not trivial.
Use width:100%
on the table and the middle column.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With