Selecting Elements in Stylesheet Rules

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: ...

Get Real World XML 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.