Recall & Review
beginner
What does
group-hover do in Tailwind CSS?group-hover lets a parent element control the hover styles of its child elements. When you hover over the parent, the child changes style.
Click to reveal answer
beginner
How do you enable
group-hover on a child element?<p>Add the <code>group</code> class to the parent and use <code>group-hover:</code> prefix on the child's class you want to change on hover.</p>Click to reveal answer
beginner
Why do you need the <code>group</code> class on the parent?<p>The <code>group</code> class marks the parent so Tailwind knows to watch it for hover events and apply styles to children with <code>group-hover:</code>.</p>Click to reveal answer
intermediate
Can
group-hover be used for keyboard focus states?No, group-hover only works for mouse hover. For keyboard focus, use group-focus instead.
Click to reveal answer
beginner
Example: What happens with this code?<br>
<div class="group"> <p class="group-hover:text-red-500">Hello</p> </div>
When you hover over the <div>, the <p> text color changes to red because of group-hover:text-red-500.
Click to reveal answer
What class must be added to the parent element to use
group-hover on children?✗ Incorrect
The group class on the parent enables group-hover styles on children.
Which of these is a correct way to change a child's background on parent hover?
✗ Incorrect
Only option C uses group on parent and group-hover: on child correctly.
Does
group-hover respond to keyboard focus by default?✗ Incorrect
group-hover only triggers on mouse hover, not keyboard focus.
What happens if you forget to add
group on the parent but use group-hover on the child?✗ Incorrect
Without group on the parent, group-hover on child does nothing.
Which Tailwind feature allows a child to change style when the parent is hovered?
✗ Incorrect
group-hover is the correct Tailwind feature for this behavior.
Explain how to use
group-hover in Tailwind CSS to change a child's style when the parent is hovered.Think about how the parent and child classes work together.
You got /3 concepts.
Describe a real-life example where
group-hover would improve user experience on a website.Consider menus or cards with icons or text that highlight on hover.
You got /3 concepts.