HTML and CSS Reference
In-Depth Information
::first-letter selector is used to pick the first letter out from the rest of the
content as if it were enclosed in an element.
The ::before and ::after pseudoelement selectors can be used to insert content
before or after (respectively) the existing content within an element (note that it
works only with elements that can hold content. It won't work with self-closing ele-
ments, such as img ). Therefore, they are part of this group because they are referring
to points in the HTML that are empty. Like the first letter, there is not explicit markup
in the HTML that designates the spot between the end of the starting tag and the be-
ginning of the content, or the end of the content and the beginning of the end tag.
Table 6-11 lists a couple pseudoelements that are in the CSS3 Generated and Re-
placed Content Module specification but have such poor browser support that you are
unlikely to be able to use them. We'll see what the future holds for them. Remember
that the specification is in draft status, so they could disappear if browser support doesn't
materialize.
Note There is a pseudoelement selector named :: selection that allows styles to
be applied to text that has been selected by the user. It was originally included in the
CSS3 Selectors module, but apparently this behavior was too radical for the W3C, and
it has since been removed. However, you will find it has strong browser support. For
example, try adding the style rule ::selection { color:#0f0; } to your page
and select some text. It will turn it green!
Miscellaneous selectors
Two additional selectors don't fit well into any of the other categories. The :lang(L)
selector finds content that is designated as being in a searched-for language (set through
its lang attribute or otherwise inherited from the metadata of the page). A language
code 7 is placed between the parentheses of the selector. See Table 6-12 for an example.
 
Search WWH ::




Custom Search