🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to HTML Notes
Topic #32

Padding & Spacing


HTML tables can adjust the padding inside the cells, and also the space between the cells.


Col 1 Col 2 Col 3
hello hello hello
hello hello hello
hello hello hello
Col 1 Col 2 Col 3
hello hello hello
hello hello hello
hello hello hello

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

th, td
{

  padding: 15px;

}

To add padding only above the content, use the padding-top property.

Add padding to the other 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;

}

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

  table
{

  border-spacing:
  30px;

}

Want to go beyond the notes?

Join CodingNow 2.0's HTML course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Padding & Spacing – FAQs

Quick answers about learning Padding & Spacing in HTML.

This free note from CodingNow 2.0 explains Padding & Spacing in HTML — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every HTML topic on CodingNow 2.0, including Padding & Spacing, is 100% free with no signup required.
With focused practice, most students grasp Padding & Spacing in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now