Chapter 5


What You Will Learn in This Chapter

  • What are tables and how are they used in HTML
  • Basic table elements and attributes
  • How to create accessible tables Code Downloads for this Chapter

You can find the code downloads for this chapter at on the Download Code tab. The code is in the Chapter 5 download and individually named according to the names throughout the chapter.

Tables display information in rows and columns; they are commonly used to display all manner of data that fits in a grid such as train schedules, television listings, financial reports, and sports results. In this chapter, you learn when to use tables and the markup that you need to create them.

To begin this chapter, you look at some examples of tables and then quickly move to the basic elements used to create them. Having learned the basics, you can then learn some of the more advanced features of tables such as adding captions and headings and achieving more complicated table layouts. The chapter ends with a discussion of accessibility issues that relate to tables, because you must understand how a screen reader would read the contents of a table for users with visual impairments.

Introducing Tables

To work with tables, you need to start thinking in grids, so start by looking at some examples of how popular websites use tables.

Figure 5-1 shows the NFL website, which has the standings for each team in a table. You can see a list of teams ...

Get Beginning HTML and CSS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.