HTML and CSS Reference
In-Depth Information
Figure 8.10
Table with
cellpadding set
to 10
Can I mix and match fixed widths and percentages?
Yes. The width attribute can be applied to table cells ( <td> elements) as well as to the entire
table ( <table> element). If you are using a table to format an entire page, you might want a
particular column used for navigation links to have a fixed width while the entire table uses a
percentage width. As always, test your Web pages using different screen resolutions to make
sure that you achieve your desired effect.
The bgcolor Attribute. This deprecated attribute specifies a background color
for the table. The values can be a color name or numeric value. See the color chart at An example with a background color, no border,
and cellpadding of 10 is shown in Figure 8.11. The XHTML code for the <table> tag
<table border="0" bgcolor="#99CCFF" cellpadding="10 ">
Figure 8.11
Borderless table
using cellpadding
set to 10 along with
a background color
The summary Attribute. This attribute specifies a summary of the table contents
that can be accessed by a screen reader. The Web Accessibility Initiative (WAI) suggests
using the summary attribute with tables containing data. For example:
Focus on Accessibility
<table border="0" width="75%" title="Birthday List"
summary="This table contains a birthday list. Each row provides
birthday and contact information for an individual. The columns
contain name, birthday, phone, and e-mail address.">
The title Attribute. This attribute specifies a title of the table that can be accessed
by a screen reader. The value of the title attribute is displayed by some browsers, such
as Internet Explorer 5 (or later), when the mouse passes over the table area. The WAI
prefers using the summary attribute or the caption element instead of the title attribute.
Focus on Accessibility
Applying Attributes to Rows and Cells
Many of the <table> element attributes discussed above can also be applied to <tr> ,
<th> , and <td> tags to customize the look of your table. In particular, the bgcolor ,
align , and width attributes are most often used. The following are commonly used
Search WWH ::

Custom Search