There are a <img> tag and <button> tag in a div. Use group in the div className and group-hover:opacity-0 in img tag, it's work properly but group-hover:top-1/2 in <button> tag doesn't work.
<div className="group relative bg-white">
<img
src={restaurant}
alt="A website image."
className="group-hover:opacity-0"
/>
<button
className="absolute -top-96 group-hover:top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
>
LEARN MORE
</button>
I add the given code on the tailwind.config.js.
module.exports = {
// ...
variants: {
extend: {
top: ['group-hover'],
}
},
}
how can I solve this????