O'Reilly logo

CSS Quick Syntax Reference by Mikael Olsson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 5

image

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required