Tables & Lists


XHTML
(eXtensible HyperText Markup Language)

Tags for Adding Tables and Lists

Tables: Basic Tags

Tag PairTag's NameUsual Attributes (in addition to 
class, id, style, title)
<table> </table>Table
  • border (px or %)
  • cellpadding (px or %)
  • cellspacing (px or %)
  • summary
  • width (px or %)
  • <caption></caption>Caption, appears centered over table 
    <tr> </tr>Row
  • align (left, right, center, justify)
  • valign (top, middle, bottom)
  • >
    <th> </th>Cell Header (usally in boldface)
  • align (left, right, center, justify)
  • colspan
  • rowspan
  • valign (top, middle, bottom)
  • <td> </td>Data cell
  • align (left, right, center, justify)
  • colspan
  • rowspan
  • valign (top, middle, bottom)
  • A Simple Table

    <table border="1">
      <caption>Table Caption</caption>
      <tr>
        <th>1st Header</th>
        <th>2nd Header</th>
        <th>3rd Header</th>
      </tr>
      <tr>
        <td>1st row, 1st cell</td>
        <td>1st row, 2nd cell</td>
        <td>1st row, 3rd cell</td>
      </tr>
      <tr>
        <td>2nd row, 1st cell</td>
        <td>2nd row, 2nd cell</td>
        <td>2nd row, 3rd cell</td>
      </tr>
    </table>    
    
    Table Caption
    1st Header2nd Header3rd Header
    1st row, 1st cell1st row, 2nd cell1st row, 3rd cell
    2nd row, 1st cell2nd row, 2nd cell2nd row, 3rd cell

    A Slightly Less Simple Table

    <table border="1">
      <caption>Table Caption</caption>
      <tr>
        <th colspan="2">1st-2nd Colummns</th>
        <th>3rd Column</th>
      </tr>
      <tr>
        <td>1st row, 1st cell</td>
        <td rowspan="2">1st row, 2nd cell 
          (2 rows tall)</td>
        <td>1st row, 3rd cell</td>
      </tr>
      <tr>
        <td>2nd row, 1st cell</td>
        <td>2nd row, 2nd cell</td>
    
      </tr>
    </table>    
    
    Table Caption
    1st-2nd Colummns3rd Column
    1st row, 1st cell1st row, 2nd cell (2 rows tall)1st row, 3rd cell
    2nd row, 1st cell2nd row, 2nd cell

    Lists

    Unordered Lists
    <ul>
      <li>An unordered list item</li>
      <li>Another unordered list item</li>
      <li>Yet another unordered list item</li>
    </ul>
    • An unordered list item
    • Another unordered list item
    • Yet another unordered list item
    Ordered Lists
    <ol>
      <li>First ordered list item</li>
      <li>Second ordered list item</li>
      <li>Third ordered list item</li>
    </ol>
    1. First ordered list item
    2. Second ordered list item
    3. Third ordered list item
    Definition Lists
    <dl>
      <dt>Definition term</dt>
         <dd>Definition description</dd>
     <dt>Another definition term</dt>
         <dd>Its definition description</dd>
    </dl>
    Definition term
    Definition description
    Another definition term
    Its definition description

    No comments:

    Post a Comment

    Beginner's Guide to HTML ADDITIONAL PAGES : Approved Properties and Values (CSS Reference) Basic Tags for Text Markup Cha...