HTML Table - Cell Padding

HTML Table - Cell Padding
Cell padding is the space between the cell edges and the cell content.

HTML Table - Cell Padding  Cell padding is the space between the cell edges and the cell content.


By default, the padding is set to 0.

To add padding on table cells, use the CSS padding property:

Example Code:

 


Output: 

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:

 


Output:

Cellpadding - top - bottom - left - right

We can specify different padding for all fours sides of the cell content.

Firstname Lastname Age
Jill Smith 50
Eve Jackson 94
John Doe 80

HTML Table - Cell Spacing Cell spacing is the space between each cell. By default the space is set to 2 pixels. To change the space between table cells, use the CSS border-spacing property on the table element: Example Code:

 


Output:

Cellspacing

Change the space between the cells with the border-spacing property.

Firstname Lastname Age
Jill Smith 50
Eve Jackson 94
John Doe 80

Comments :

Post a Comment