HTML and CSS Reference
In-Depth Information
Note If it was just the first item of a particular type that was being selected and that
behavior was not going to change, the new :first-of-type selector could be used
instead. However, the nth-of-type selectors can use the an+b formula to pick out more
than one element.
Pseudoelement selectors
The elements in Table 6-10 are perhaps less common to encounter because their beha-
vior is rather unique among the different selector categories. As you will soon see, they
enable styles to be applied to parts of an element that aren't otherwise accessible. While
you may recognize the selectors listed in Table 6-10 , you may notice that their syntax
has changed to include two colons instead of one at the beginning of the selector. See
the “What makes a pseudoelement?” sidebar later in this section for more information.
The ::first-line and ::first-letter selectors are self-explanatory, be-
cause they select the first line of text and first letter of text within an element. For ex-
ample, they can be used to create “drop caps” at the beginning of paragraphs and stylist-
ically change the first line of text, as shown in Figure 6-9 .
Search WWH ::

Custom Search