Chapter 3. Selectors

In this chapter, you learn about the different types of selectors that CSS supports. In Chapter 2, you learned about the type selector, which is a selector that applies style sheet declarations by using the HTML element's name. "Selectors" is an area of CSS that I discuss that has spotty support with regards to IE 6. To those ends, as I introduce each section, if a selector is not supported by IE 6, I note that. IE 7 features much better selector support, and in fact supports nearly all of the selectors discussed in this chapter, but there are a few selectors that IE 7 doesn't support. This is also noted where appropriate. Other browsers such as Mozilla Firefox, Safari, and Opera all have excellent support for the selectors discussed in this chapter. With each example, I note what browser you should use to view the example, and which browsers the example won't work with.

You may wonder why I bother discussing selectors that don't work in IE 6. I chose to include the selectors with at least some browser support, because each reader's needs and development requirements are different. If you are, for instance, developing a corporate intranet-based application in which you have full control over the browser the end user is using, your needs are different from someone who is developing a publicly-accessible Internet website. Someone developing a corporate intranet site can, for instance, choose Mozilla Firefox as their development platform, rather than IE 6, or that ...

Get Beginning CSS: Cascading Style Sheets for Web Design, Second 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.