
CSS Primer
❘
177
If you actually performed this example, you would see that the fi rst paragraph is large and uses
small-caps, while the second paragraph would have basically the same look and feel as the other
examples in this chapter.
In order for an HTML page to be 100% valid, IDs are not supposed to be reused
throughout a document. Although you could actually reuse the same ID more
than once and most browsers would display both just fi ne without error, you
should avoid this practice. There is no guarantee that later versions of browsers
wouldn’t ignore a reused ID because it is not acceptable according to the W3C.
Selectors
If you have been following the chapter until this point, you have already been exposed to selectors;
you just didn’t know it. In CSS, a selector merely identifi es to what the style rules should be applied.
For example, consider the previous code example:
p{
font-family: arial;
font-size: 14pt;
color: black;
}
In this example, the selector is the <p> element; thus, the style rules enclosed in the brackets apply to
all
<p> elements in the HTML document that uses this style sheet. This type of indicator is called a
type selector because you are selecting a particular type of HTML element. You have also seen how
to handle class selectors (e.g.,
.big) and ID selectors (e.g., #header) in the previous section.
However, this just scratches the surface of how you can sele ...