Attributes Of Table Tag

FAST DOWNLOADads
Download


 It is used to specify a border and its thickness for a table Attributes of Table Tag

  1. Border: It is used to specify a border and its thickness for a table.
  2. Cellspacing: It is used to specify the distance between adjacent cells in a table.
  3. Cellpadding: it is used to specify the distance between a cell and cell contents in a table.
  4. Width: It is used to specify width of a table in pixels or as percentage to screen width.
  5. Align: It is used to specify the horizontal alignment of a table. Possible horizontal alignment values are "left", "right" or "center".
  6. Valign: It is used to set the vertical alignment of a table as "top", "bottom" or "middle".
  7. Bgcolor: It sets the background color of a table. You can specify color names or hex values for the color.

    Example of table with border=1, width=200 and align=center attributes

    HTML Coding:

    <table border="1" width="200" align="center">
    <tr>
    <th>Book</th><th>Price($)</th>
    </tr>
    <tr>
    <td>Visual Basic</td><td>75</td>
    </tr>
    <tr>
    <td>C++</td><td>45</td>
    </tr>
    </table>

    BookPrice($)
    Visual Basic75
    C++45

    Example of table with border=5, cellpadding="10" and cellspacing="10"

    <table border="5"  cellpadding="10" cellspacing="10">
    <tr>
    <th>Book</th><th>Price($)</th>
    </tr>
    <tr>
    <td>Visual Basic</td><td>75</td>
    </tr>
    <tr>
    <td>C++</td><td>45</td>
    </tr>
    </table>
    BookPrice($)
    Visual Basic75
    C++45

     Example table with border="5" width="300" bgcolor="yellow"

    <table border="5" width="300" bgcolor="yellow">
    <tr>
    <th>Book</th><th>Price($)</th>
    </tr>
    <tr>
    <td>Visual Basic</td><td>75</td>
    </tr>
    <tr>
    <td>C++</td><td>45</td>
    </tr>
    </table>

    BookPrice($)
    Visual Basic75
    C++45
    FAST DOWNLOADads
    Download
    Next Post Previous Post
    No Comment
    Add Comment
    comment url