Chapter 11 Creating Tables

To create a table

Creating a Simple Table

  1. Create a table tag:

    <table>
    </table>
  2. Insert row tags for as many rows as you need:

    <table>
       <tr></tr>
       <tr></tr>
    </table>
  3. Within each row, insert table cell tags for as many cells as you need:

    <tr>
       <td></td>
       <td></td>
    </tr>
  4. Type text and/or insert other content, such as images, between the opening and closing table cell tags:

    <td>text</td>
    <td><img src="filename.ext" /></td>

To specify the width of a table

Specifying the Size of a Table

Within the tag:

<table width=n>

where n is a percentage (such as 100%) or a number of pixels (such as 600px).

In a style sheet:

table {width=n}

To specify the height of a table

Specifying the Size of a Table

Within the tag:

<table height=n>

where n is a percentage (such ...

Get HTML and XHTML Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.