Aligning Text Within Cells

Columns and rows do most of the heavy lifting in aligning text in a table, but you can fine-tune the adjustment in several ways.
You can add the cellpadding attribute to the opening <table> tag and specify the amount of space between the cell contents and borders; for example <table cellpadding=“8px”>. This applies a uniform amount of padding to all cells. The drawback is that this is HTML, not CSS, so it doesn’t carry the benefit of being able to change the cell padding for all tables on your site by editing a single style in a CSS file.
Use the padding property to add space between cell contents and borders. This enables you to use different amounts of padding for different cell elements; for example, you may want ...

Get The Complete Idiot's Guide® To HTML5 and CSS3 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.