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 spacing

Description:


How to create cell spacing in an html page.

Code:

<html>
<body>


<h4>Without cell spacing</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 cell spacing</h4>
<table border="1" cellspacing="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 cell spacing</h4>
<table border="1" cellspacing="20">
<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 spacing in a table, you just have to use attribute cellpadding in the <table> tag. With this attribute you can change the distance between cells.

See Also:

HTML: Html, Body, Table, Tr, Td


Online Html Forum  Discuss this tutorial in our HTML forum


     Credit Reports | Secured Loans | Free Advertising | Homeowner Loan | Loans
Home     Link To Us     Ad With Us     Contact Us     Tell A Friend     Affiliates     Blog     MsOfficeHelp