O'Reilly logo

HTML5: Your visual blueprint™ for designing rich web pages and applications by Adam McDaniel

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

SELECT AN HTML ELEMENT USING THE STRUCTURAL TYPE PSEUDO-CLASS

Apseudo-class is a predefined class that a web browser uses to match a specific type or pattern of elements. In CSS3, the list of pseudo-class names was expanded in two new areas: type and child. The type pseudo-class is described here; the child pseudo-class is discussed in the following section, “Select an HTML Element Using the Structural child Pseudo-Class.”

The structural type pseudo-class matches a series of like elements within a shared parent:

element:first-of-type { ... }element:last-of-type { ... }element:only-of-type { ... }element:nth-of-type(counter) { ... }element:nth-last-of-type(counter) { ... }

The :first-of-type and :last-of-type selectors match the first and last ...

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