Chapter 5

Tables

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

Wrox.com Code Downloads for this Chapter

You can find the wrox.com code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=9781118340189 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 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.