This chapter is dedicated to understanding how to create stylesheets. After going through the mechanics, we'll first see a lot of examples at work; then we'll spend some time with the actual CSS specification. I'll start by taking a look at how to create selectors, which indicate what element or elements you want to attach a style rule to. In the stylesheet we've already seen, ch09_02.css, the selectors are of the simplest kind and select just one element by giving the name of that element: TITLE {display: block; font-size: 24pt; font-weight: bold; text-align: center; text-decoration: underline} AUTHOR {display: block; font-size: 18pt; font-weight: bold; text-align: center} SECTION {display: block; font-size: 16pt; font-weight: bold; text-align: center; font-style: italic} P {display: block; margin-top: 10} For example, here I'm applying the style specification {display: block; font-size: 24pt; font-weight: bold; text-align: center; text-decoration: underline} to the <TITLE> element, {display: block; font-size: 18pt; font-weight: bold; text-align: center} to the <AUTHOR> element, and so on. As you can see, one type of selector just lists the element you want to style. However, you can create many other types of selectors, such as grouping elements. |