Styling First and Last Child in CSS


Target the first and last child of a container for unique styling using :first-child and :last-child pseudo-classes.

Source Code

li:first-child {
    font-weight: bold;
}
li:last-child {
    font-style: italic;
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments