CHAPTER 5
Pseudo selectors
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 a colon.
Pseudo-elements
The pseudo-elements enable parts of an element to be styled. There are four of them in CSS, as discussed in the following sections.
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; }
The preceding first ...
Get CSS Quick Syntax Reference 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.