Adscend

Click Here



Click Here



Click Here

Sunday 8 September 2013

Table Cellpadding

HTML Table Cellpadding

Cellpadding attribute is used to add space around the inner content of table cells(in th and td elements).
Cellpadding attribute places spacing around data within each cell.

Syntax:
<table cellpadding="pixels">

Table without cellpadding:

Example: 1

<html>
     <body>
        <table border="1" >
            <tr>
                <th colspan="2">Student</th>
            </tr>
            <tr>
                <th>Name</th>
                <th>Roll</th>
            </tr>
            <tr>
                <td>Alex</td>
                <td>10</td>
            </tr>
            <tr>
                <td>Susie</td>
                <td>11</td>
            </tr>
        </table>
    </body>
</html>

Output

Student
Name Roll
Alex 10
Susie 11


Table with cellpadding:

Example: 2

<html>
   <body>
        <table border="1" cellpadding="5">
            <tr>
                <th colspan="2">Student</th>
            </tr>
            <tr>
                <th>Name</th>
                <th>Roll</th>
            </tr>
            <tr>
                <td>Alex</td>
                <td>10</td>
            </tr>
            <tr>
                <td>Susie</td>
                <td>11</td>
            </tr>
        </table>
    </body>
</html>

Output

Student
Name Roll
Alex 10
Susie 11




No comments:

Post a Comment