Grokking CSS for Web Development
Vote

0% completed

​

Targeting the first or last element in a list

Four links and one search field sit inside the settings menu from the previous lesson, and the selector .menu a:last-child matches none of them. The reason is the exact rule that position pseudo-classes follow, and that rule is the subject of this lesson.

A position pseudo-class matches an element by where it sits among its siblings, the elements that share its parent. :first-child matches an element that is the first child of its parent. :last-child matches an element that is the last child of its parent

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content