5.4 CSS Structural Pseudo-Class Selectors

The previous chapter described lists, and this chapter describes tables and tabular formatting. All of these things involve collections of elements. When you have a collection of elements, sometimes you want to display one or more of those elements differently from the rest. You could do that by including class attributes in each element that you want to display differently. You would then use the class attribute’s value as a class selector in a CSS rule. But if the number of elements that you want to display with a special format is large, then quite a few class="value" code insertions would be required.

When there is regularity in the locations of certain elements within a collection of elements, ...

Get Web Programming with HTML5, CSS, and JavaScript 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.