How to centralize information for all TDs by CSS?

Question:

I have a bunch of <td> and I need them centralized. I would like to do by CSS, for example

td {
   puxar por aqui.
}

This instead of putting align="center" on all tds.

How to do this, affecting all the table cells that are on the page?

Answer:

td {
   text-align: center;     /* alinhamento horizontal */
   vertical-align: middle; /* alinhamento vertical */
}

This rule would apply to all TDs unless some later or more specific rule overrides these alignment properties in your CSS.

Scroll to Top