Recall & Review
beginner
What does the <code>:first-child</code> CSS pseudo-class select?It selects the very first child element inside its parent container.
Click to reveal answer
beginner
How do you target the last child element using Tailwind CSS?
Use the
last: variant before a utility class, for example, last:bg-blue-500 changes the background of the last child.Click to reveal answer
beginner
Why is targeting first-child and last-child useful in web design?
It helps style only the first or last item differently, like adding extra space or a special color, making lists or menus look neat and clear.
Click to reveal answer
intermediate
How would you add a top border only to the first item in a list using Tailwind?
Use
first:border-t on the list items to add a top border only to the first child.Click to reveal answer
intermediate
What is the difference between
:first-child and :first-of-type selectors?:first-child selects the first child regardless of type, while :first-of-type selects the first child of a specific element type.Click to reveal answer
Which Tailwind prefix targets the last child element?
✗ Incorrect
The
last: prefix in Tailwind targets the last child element.What does
first:bg-red-500 do in Tailwind?✗ Incorrect
The
first: prefix applies the style only to the first child.Which CSS pseudo-class selects the last child element?
✗ Incorrect
:last-child selects the last child element inside a parent.If you want to add margin only to the first item in a list using Tailwind, which prefix do you use?
✗ Incorrect
The
first: prefix targets the first child element.What happens if you use
last:border-b-2 on list items?✗ Incorrect
The
last: prefix applies the border only to the last child.Explain how you would style the first and last items in a navigation menu differently using Tailwind CSS.
Think about how to add different colors or spacing to the first and last menu items.
You got /4 concepts.
Describe the difference between the CSS selectors :first-child and :last-child and how Tailwind helps you use them.
Focus on what each selector targets and how Tailwind makes it easy to apply styles.
You got /4 concepts.