HTML Table cellpadding attribute
HTML table cellpadding attribute can be used to design the distance between the elements and borders within form fields, belonging to the HTML form the basic properties of the default HTML form text or images within, will stick together with the border, we can make the text or through cellpadding There is a distance between the picture and the table border, creating a more beautiful table and content presentation effect. The effect of using cellpadding in HTML Table is equivalent to using css padding in each table field (td) . Later, an example will be used to show the syntax difference between the two.
HTML Table cellpadding syntax
HTML Table cellpadding usage example 1: Design directly with cellpadding
<table border="1">
<tr><td>This is the content of the test field</td><td>The content of the test field</td></tr>
</ td> table>
Table with cellpadding attribute already used
<table cellpadding="8" border="1">
<tr><td>This is the test field content</td><td>This is the test field content</td ></tr>
</table>
This is the test field content | This is the test field content |
Table with cellpadding property already used
This is the test field content | This is the test field content |
HTML Table cellpadding usage example 2: Switch to css padding design
<tr><td style="padding:8px;" >This is the test field content</td><td style="padding:8px;">This is the test field content< /td></tr>
</table>
This is the test field content | This is the test field content |
Table cellpadding is often confused with cellspacing. The two have different effects. Cellspacing is used to design the distance between table elements. For example, the distance between each field can be designed with cellspacing. Please see this introduction: HTML Table cellspacing attribute .
Post a Comment
0 Comments