Web Design

(Nancy Kaufman) #1

165


CHAPTER

Adding Tables and Lists 7


TIPS


Can I add borders to the individual cells?
Yes, by simply creating a CSS declaration that uses
td as the selector and a border property as the rule.
You may also want to add the border-
collapse:collapse rule to the table
declaration so that the cell border widths do not
appear to be doubled.

Can I create alternating background colors for
the rows?
Yes. You simply need to create two classes in your
CSS, applying different background-colors to
each. Then, add the appropriate class attribute to
each alternate <tr> tag in your document.

● When viewed in a browser,
the table now has the
specified background color,
and the border is visible
around the outside edge
of the table.

8 Press.


9 Type border:?? ?;,
replacing? with border
width, style, and color
values.


0 Press.


! Type }.


9


11

Free download pdf