Chapter 4. Tables

Tables are commonly used to display all manner of data, such as timetables, financial reports, and sports results. So when you want to display information in rows and columns, you need to use the markup that you will learn about in this chapter to create a table.

This chapter begins with a discussion of the basic elements that are used to create all tables. Then I introduce some of the more advanced features of tables such as captions, headings, and more complicated table layouts. You will also learn about some deprecated markup that was designed to control the appearance of tables. Even though it is preferable to use CSS to control the way a page looks, you will sometimes need to use the older markup so that viewers with older browsers can see your pages as you intend them to be. The chapter ends with a discussion of accessibility issues that relate to tables because they can have a serious effect, particularly for users with visual impairments.

Introducing Tables

In order to work with tables, you need to start thinking in grids. Tables, just like spreadsheets, are made up of rows and columns, as shown in Figure 4-1.

Here you can see a grid of rectangles. Each rectangle is known as a cell. A row is made up of a set of cells on the same line from left to right, while a column is made up of a line of cells going from top to bottom.

By now you have understood that the names of elements in XHTML tend to refer to the type of markup they contain. So you will hardly be surprised ...

Get Beginning Web Programming with HTML, XHTML, and CSS, Second Edition 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.