Table Padding and Spacing HTML
Table Padding and Spacing HTML
Spacing
❮ PreviousNext ❯
HTML tables can adjust the padding inside the cells, and also the space
between the cells.
With Padding
Example
th, td {
padding: 15px;
}
Try it Yourself »
To add padding only above the content, use the padding-top property.
And the others sides with the padding-bottom, padding-left, and padding-
right properties:
Example
th, td {
padding-top: 10px;
padding-bottom: 20px;
padding-left: 30px;
padding-right: 40px;
}
Try it Yourself »
To change the space between table cells, use the CSS border-spacing property
on the table element:
Example
table {
border-spacing: 30px;
}
Try it Yourself »
Exercise?
What is the correct CSS property for styling the padding inside table cells?
padding
table-padding
cell-padding