Chapter 12. Styling Web Pages with Cascading Style Sheets

IN THIS CHAPTER

  • Testing your browser

  • Coping with browser support issues

  • Cascading priorities

  • Redefining HTML elements

  • Assigning classes

  • Using IDs

  • Defining nested elements with contextual selectors

  • Consulting the CSS reference

  • Using stylesheet-creation programs

  • Interesting CSS sites

  • Adding layers

  • Clipping layer content

  • Handling large elements with overflow attributes

Cascading style sheets (CSS) have the potential to provide Web page designers with a fabulous degree of control over the appearance and functionality of their sites. Using CSS, you can specify the styles used in HTML pages for a whole Web site, per page, or for each tag. This allows the designer to separate the content from the presentation — a good idea when it comes to making changes in a 1,000-page Web site.

Note

All of the formatting instructions in HTML have been deprecated in favor of their CSS equivalents.

Using CSS, you can reduce the size of your HTML files, which in turn reduces the download time, improving user satisfaction because the page downloads faster. It also reduces the disk space used on both server and client machines, and lessens the load on the server and network. All of this means that your Web site can support more users.

What if you don't use CSS? Several well-known office applications create HTML files that don't use CSS. However, the same files with CSS can be reduced by half or more of their original size, and so will download two to three times faster ...

Get Creating Web Sites Bible, Third Edition 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.