WHAT YOU WILL LEARN IN THIS CHAPTER:
Tables are primarily a method to show the relationship between data, much as a spreadsheet application does. Tables can be complex creatures in HTML, but if used properly, they allow information to be presented in a neat, organized, and consistent manner.
The <table> element has several optional elements that can be used to enhance the presentation and semantic value of a table, including captions, columns, headings, and footers. Take a look at a <table> element that makes use of all these optional elements. When I get into the discussion of styling tables, beginning with the section “Table Captions,” you'll need to understand what is possible in a table. The following markup shows a table complete with all the required and optional elements.
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> <html lang=“en”> <head> <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”> <title>FIGURE 12-1</title> </head> <body> <table> <caption>Ingredients</caption> <colgroup> <col class=“ingredient”> <col class=“quantity”> </colgroup> ...