Simple Tables


Traditionally, tables have been used for displaying tabular data (such as numbers) in rows and columns. The flexibility of HTML, however, enables Web developers to create tables that display more than just numbers. In fact, as important as the capability to display tabular data is, even more important to Web designers is the capability to control the layout of other document elements (such as text and images).

Table

An arrangement of horizontal rows and vertical columns. The intersection of a row and a column is called a cell.


Caution

Although HTML tables look similar to your favorite spreadsheet, HTML tables don't perform mathematical functions.


HTML tables are not difficult to create, but they do require some organization. All HTML tables begin with the <table> tag and end with the </table> tag. In between those tags are three other tags to be aware of, as follows:

  • <tr> defines a horizontal row.

  • <td> defines a data cell within that row.

  • <th> specifies a data cell as a table heading. In newer browsers, a table heading cell is formatted as centered and bold.

Remember that Web browsers ignore any spaces, tabs, and blank lines that you include in your HTML document. So, feel free to use spacing to help you keep track of the table tags. Figure 7.1 shows enough blank spaces between the tags so that you can see the rows and columns lining up. It makes it easier to ensure that you don't forget any tags. Figure 7.2 shows how that table looks in a browser.

Figure 7.1. A simple two-column, three-row HTML table.


Figure 7.2. That same HTML table as it appears in the browser.




Sams Teach Yourself HTML in 10 Minutes
Sams Teach Yourself HTML in 10 Minutes (4th Edition)
ISBN: 067232878X
EAN: 2147483647
Year: 2004
Pages: 151
Authors: Deidre Hayes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net