HTML and CSS Reference
In-Depth Information
Can you image the number of possibilities this selector brings with it, and
the amount of useless selectors you could strip out o " your CSS files were it
widely supported?
Notes on browser support
Internet Explorer is our usual party pooper here: no support at all, not even
on IE8. This probably means that this selector will still have to wait a while
before some developers lose the fear of adding them to their stylesheets.
8. Pseudo-elements
Pseudo-elements allow you to access elements that don't actually exist in
the HTML, like the first line of a text block or its first letter.
Pseudo-elements exist in CSS 2.1, but the CSS 3 specifications state that
they should be used with the double colon “ :: ”, to distinguish them from
pseudo-classes. In CSS 2.1, they are used with only one colon, “ : ”. Browsers
should be able accept both formats, except in the case of pseudo-elements
that may be introduced only in CSS 3.
::FIRST-LINE
The ::first-line pseudo-element will match the first line of a block,
inline-block, table-caption or table-cell level element.
This is particularly useful to add subtle typographical details to your text
blocks, like, for example, transforming the first line of an article into small
caps:
h1 + p::first-line {
font-variant: small-caps;
}
Search WWH ::




Custom Search