I have a HTML table. Each cell has content of different length.
For this reason, the content is not aligned on the top.
I would like the first lines be aligned also in cells with few lines of text (the content should always start from the top).
Instead the content is vertically centered in the middle.
How can I fix this (a cross-browser solution.. working in I.E. as well)
Thanks
To center align text in table cells, use the CSS property text-align. The <table> tag align attribute was used before, but HTML5 deprecated the attribute. Do not use it. So, use CSS to align text in table cells.
Select the text and go to the Layout tab and the Alignment section of the ribbon. Choose “Align Center.” Your text will then be right in the middle of the cell. Centering the text in your Word table is a simple task whether horizontally, vertically, or both.
in css
td, th {
vertical-align:top;
}
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