eHow launches Android app: Get the best of eHow on the go.

How To

How to Build a HTML Table

Contributor
By Lady_Glass
eHow Contributing Writer
(0 Ratings)

A HTML table is a significant method for displaying and arranging tabular data on a web page or for constructing an email in HTML. Tables may contain various types of information including lists, links and images. You can adjust the size of your tables as well as specify certain details, such as how many columns, rows and headings you have use for. Tables easily work into a web page and only require a few key tags to build one.

Difficulty: Moderately Easy
Instructions

Things You'll Need:

  • HTML text editor, such as BBEdit or Dreamweaver
  1. Step 1

    Open a document in an HTML text editor, such as BBEdit or Dreamweaver. Enter the opening <table> tag. This is the initial element that begins your table.

  2. Step 2

    Specify the width, border, cellspacing and cellpadding within the opening <table> tag. The width dictates how wide your table is; the border indicates the thickness of the table's outline; the cellspacing specifies the area around the table's cells; and the cellpadding outlines the space around the table's text. For example: <table width="400" border="1" cellspacing="5" cellpadding="3">

  3. Step 3

    Enter a summary within the <table> tag. The summary is a description of what your table contains and is necessary to provide information to those viewers who use a screen reader. For example: <table width="400" border="1" cellspacing="5" cellpadding="3" summary="This is a demonstration HTML table">

  4. Step 4

    Enter the caption of your table and specify its alignment, such as top or bottom, according to your preference. For example: <caption align="top">Sample HTML Table</caption>

  5. Step 5

    Enter the opening <tr> tag to add your first table row.

  6. Step 6

    Enter the opening <th> tag, add the text of your column heading, and enter the closing </th> tag. This tag gives the table a column and makes the text bold to indicate it is a column title.

  7. Step 7

    Enter the amount of columns and column headings you require. For example, a table with 3 columns is entered as: <th>Column 1</th><th>Column 2</th><th>Column 3</th>

  8. Step 8

    Enter an opening <tr> and <td> tag, add the table's data and enter the closing </td> and </tr> tags. A table with 3 columns will have 3 opening and closing <td> tags so that each table data corresponds to a space under a column heading. For example: <tr><td>Row 1, Column 1</td><td>Row 2, Column 2</td><td>Row 3, Column 3</td></tr>

  9. Step 9

    Enter the closing </table> tag to complete your table.

Tips & Warnings
  • You can add a background or border color to your table by entering it within the opening <table> tag. For example: <table bgcolor="gray" bordercolor="blue">

References

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Tags
Get Free Internet Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

Demand Media
eHow_eHow Technology and Electronics