untitled

(John Hannent) #1
Some values are described with more than one word, such as minty green
rather than green. When you have a multi-word value, enclose the value name
in quotes:

p {color: “minty green”;}

This notation is similar to how some database software handles
multi-word terms.

Also, if you define more than one property for a selector, separate those
properties with semicolons, as in the sample CSS style you used earlier in
this chapter:

p
{
color: blue;
text-align: right;
font-family: courier;
}

You can format a CSS style any way you wish. The braces serve as delimiters
(or separators), so the browser knows that a selector’s properties end when
it comes upon a close brace symbol (}). Some people like to put each prop-
erty on its own line to make it easier to read.

Grouping ...............................................................................................

If you wish, you can define a whole bunch of tags (selectors) all at once. This
can save time if you want allyour headline elements, for example, in an Arial
typeface. HTML has four headline elements: H1, H2, H3, and H4. Instead of
defining each different headline element as a separate style in your CSS file,
just pile the selectors all together, separated by commas. In this example,
headline sizes from heading 1 all the way down to heading 4 are defined
as Arial:

h1,h2,h3,h4
{
font-family: Arial;
}

Showing Some Class .....................................................................................


What if you want to subdivide a given tag (selector) style into several alterna-
tives? It’s similar to dividing your Recipes collection into sub-categories like
Chinese, Mexican, Thai, and so on.

Chapter 2: Getting Results with CSS 35

Free download pdf