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

Get HTML5: Your visual blueprint™ for designing rich web pages and applications 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.