HTML table td align

For aligning text horizontally, use text-align CSS property.

For aligning vertically, use the vertical-align CSS property.


table.mytable td
  vertical-align: top;

table.mytable td.numbers

table td align example

Horizontal text align values

Horizontal text align values

The text-align CSS attribute takes these values: left, center and right. The other supported values are: justify – stretch the lines to fit to the available width (like a newspaper column) and start and end.

There are languages that are written right to left rather than left to right. When you take that in to consideration, aligning left or right does not make sense. So two more values are added in CSS3 that is start and end.

Vertical text align values

vertical-align can be: top, middle or bottom. In addition, there is a baseline value that aligns the base line of the first line in the cell. baseline is the default value.

HTML table td vertical-align


Click Edit and then try changing the align values.


Read More

HTML table tutorial and reference


Copy and paste this code to display the image on your site