Complete the code to make the child text color change when hovering over the parent.
<div class="group [1]"> <p class="text-gray-500 group-hover:text-blue-500">Hover me!</p> </div>
The hover:bg-gray-200 class on the parent div triggers the hover state, allowing the child to respond with group-hover:text-blue-500.
Complete the code to make the child element visible only when hovering over the parent.
<div class="group relative"> <button class="px-4 py-2 bg-gray-300">Menu</button> <ul class="absolute hidden [1]"> <li>Item 1</li> <li>Item 2</li> </ul> </div>
hover:block which only works if the element itself is hovered.group class on the parent.The group-hover:block class makes the hidden list appear when the parent div is hovered.
Fix the error in the code to make the child text bold when hovering over the parent.
<div class="group"> <p class="[1] group-hover:font-bold">Hover me!</p> </div>
The child should start with font-normal so that group-hover:font-bold changes it on hover. If it starts bold, the hover effect won't show a change.
Fill both blanks to make the child background color change and text color change when hovering over the parent.
<div class="group [1]"> <p class="p-2 [2] group-hover:text-white">Hover me!</p> </div>
The parent needs a hover background color class to trigger the group-hover effect. The child starts with a lighter green background bg-green-300 and changes text color on hover.
Fill all three blanks to create a card that changes border color, shadow, and text color on child when hovering over the parent.
<div class="group border-2 [1] p-4 rounded"> <h2 class="text-lg font-semibold [2] group-hover:text-purple-700">Card Title</h2> <p class="text-gray-600 [3]">Card content goes here.</p> </div>
The parent div changes border color on hover with hover:border-purple-500. The child heading gets a shadow on group hover with group-hover:shadow-lg. The paragraph text color changes on group hover with group-hover:text-gray-800.