Search DaTutorials:  
HOME
Html Tutorials
Basics
Forms
Frames
Hyperlinks and URLS
Images
Lists
Background
Colors
Fonts
Tables
Meta Tags
Events
Javascript Integration
Sound
Other
Search For a Tutorial
Html Reference

Cell padding

Description:


How to create cell padding in a table.

Code:

<html>
<body>


<h4>Without cellpadding</h4>
<table border="1">
<tr>
  <td>cell 1</td>
  <td>cell 2</td>
</tr>
<tr>
  <td>cell 3</td>
  <td>cell 4</td>
</tr>
</table>


<h4>With cellpadding</h4>
<table border="1" cellpadding="10">
<tr>
  <td>cell 1</td>
  <td>cell 2</td>
</tr>
<tr>
  <td>cell 3</td>
  <td>cell 4</td>
</tr>
</table>


<h4>With more cellpadding</h4>
<table border="1" cellpadding="30">
<tr>
  <td>cell 1</td>
  <td>cell 2</td>
</tr>
<tr>
  <td>cell 3</td>
  <td>cell 4</td>
</tr>
</table>


</body>
</html>

Play with the code:

See working example:


Explanation:

To create cell padding in a table, you just have to use attribute cellpadding in the <table> tag. With this attribute you can change the white space between borders and the cell content.

See Also:

HTML: Html, Body, Table, Tr, Td


Online Html Forum  Discuss this tutorial in our HTML forum


     Mortgage | Mortgage Calculator | Mortgages | Avatar | Car Insurance
Home     Link To Us     Ad With Us     Contact Us     Tell A Friend     Affiliates     Blog     MsOfficeHelp