Cascading Style Sheets: "Selectors"

Selectors are the means through which a CSS file "selects" specific elements from an HTML file and then applies a specified style to those elements. For example, if you want to apply a style to some, but not all paragraphs on your webpage, class selectors will allow you to do this; similarly, if you want to apply a style just one element on your webpage, id selectors will make this possible. In this regard, selectors are the core technique that enables you to abstract presentational information into the CSS file while leaving semantic information in the HTML file. NOTE: Since Internet Explorer 6 is extremely outdated at this point, you may choose to ignore the advice given in this chapter about incompatibilities with this browser; also don't worry about discussion of XML or later versions of CSS that appear in this chapter, as these are not concepts you need to know to continue working with your example webpage.

Spend some time looking at the CSS file you have already created and experimenting with selectors to modify the presentation of your HTML file. Remember that id and class selectors will only work if you specify the ids or classes in your "index.htm" file - go ahead and experiment with this using the examples in this chapter.