O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Classes

Besides elements, you can create selectors using classes. Here's an example. In this case, I'll create a class named RED that specifies that elements it's applied to must use a foreground (text) color of red and a background color of pink; to define a general class such as RED, you must preface it with a dot (.), as in .RED:

Listing . ch09_06.css
 
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}
.RED {color:red; background-color: pink}
				

To apply this class to an individual ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required