Chapter 8. More Cascading Style Sheets

In this chapter, you will continue to learn how to use CSS to control presentation of XHTML web pages, starting with CSS properties that enable you to control presentation of links, backgrounds, list styles, table styles, and outlines around boxes. You will then learn a technique to add content to a page (even if it was not in the XHTML document) using the :before and :after pseudo-classes. Finally, you will see how CSS can be used to position boxes on the page, which will allow you to create attractive layouts for your pages.

By the end of the chapter, you will know how to use CSS to control the following:

  • Presentation of links

  • Backgrounds of document

  • Styles of bullet points and numbered lists

  • Appearance of tables

  • Outlines around boxes

  • Elements that can gain focus or are active

  • Addition of content to the XHTML document before or after an element

  • The three positioning schemes that allow you to determine where on a page a box will appear — something that prepares you to use CSS to create layouts

Occasionally in this chapter, you will come across a feature that is not yet implemented by the main browsers, but it is worth learning these now as they are likely to be used as standard in the near future.


Most browsers show links in blue with an underline and change the color of links you have already visited, unless you tell them to do otherwise. The following are properties often used with links:

  • color: Changes the colors of the links

  • background-color

Get Beginning HTML, XHTML, CSS, and JavaScript® now with the O’Reilly learning platform.

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