Creating Style Rules

We've seen how to create selectors in rules; it's time to take a look at creating rules themselves. A rule is composed of a selector followed by a semicolon-separated list of property-value pairs enclosed in curly braces, like this:

TITLE {display: block; font-size: 24pt; font-weight: bold;
text-align: center; text-decoration: underline}

In this case, I'm setting values for the display, font-size, font-weight, text-align, and text-decoration properties. You assign a value to a property by following the name of the property with a colon, whitespace, and the value that you want to assign.

Quite a number of properties are defined in CSS, and the best way to get a grip on what's going on is to actually use them, so we're about ...

Get Inside 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.