© Mikael Olsson 2019
Mikael OlssonCSS3 Quick Syntax Referencehttps://doi.org/10.1007/978-1-4842-4903-1_5

5. Pseudo Selectors

Mikael Olsson1 
(1)
Hammarland, Finland
 

The pseudo-classes and pseudo-elements are keywords that can be appended to selectors to make them more specific. They are easy to recognize because they are always preceded by one or two colons.

Pseudo-Elements

Pseudo-elements enable parts of an element to be styled. Only one of these can be applied to any one selector.

first-letter and first-line

The pseudo-elements ::first-letter and ::first-line can apply styles to the first letter and the first line of an element. They work only on block elements such as paragraphs.
p::first-letter { font-size: 120%; }
p::first-line { font-weight: bold; ...

Get CSS3 Quick Syntax Reference: A Pocket Guide to the Cascading Style Sheets Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.