Jump to: navigation, search

HTML Table Cell Spacing and Cell Padding

From w3cyberlearnings

Contents

HTML Table Cell Padding and Spacing

By using CSS, you can define the table cell spacing and padding.

Example 1 TRY-IT

We define the table cell padding, cell spacing, and table border by using CSS.

<style>	
table {
	padding:8px;
	border-spacing: 10px;
	border:1px solid #2b81af;
}
td,th {
      padding:10px;
}
</style>

Example 2 TRY-IT

We define the table row color based on the odd and even row; we also define the cell spacing and cell padding.

<style>
	table {
		padding:8px;
		border-spacing: 40px;
	}
	.odd {
		background-color:blue;
	}
	.even {
		background-color:red;
	}
</style>

Related Link


Table
  1. HTML - Table
  2. HTML - Table Border
  3. HTML - Table Column
  4. HTML - Table Row
  5. HTML - Table Color
  6. HTML - Table Cell Spacing and Padding
  7. HTML - Text Align
  8. HTML - Text Vertical Align
  9. HTML - Table Caption and Summary
  10. HTML - Table thead, tbody, tfoot
  11. HTML - Inner Table
  12. HTML - Table Vertical Line
  13. HTML - Table Horizontal Line
Navigation
Web
SQL
MISC
References