Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tailwindcss use hover over group-hover

Tags:

tailwind-css

I added a group hover to an element but also a hover to that element. The group-hover works, but when I hover over the element itself the background color doesn't change.

bg-green-500 group-hover:bg-green-200 hover:bg-green-500
like image 877
Tijl Ivens Avatar asked Dec 06 '20 16:12

Tijl Ivens


People also ask

How do you use the last child in tailwind?

Just use last:${yourClassName} to target the last child in your case. Even though the other answer, this answer now points to the best way to do first/last child selection.

How do you style a placeholder in Tailwind CSS?

In Tailwind CSS, you can style the placeholder text of an input field (or textarea) by using the placeholder modifier (a modifier is a prefix word that can be added to the beginning of a utility class). That's it.


1 Answers

This is now possible with Tailwind Just-in-Time mode, using the built-in important modifier:

<div className="group">
  <div className="opacity-0 group-hover:opacity-50 hover:!opacity-100">
    Note the magic of the exclamation point!
  </div>
</div>
like image 164
sean_j_roberts Avatar answered Jan 04 '23 06:01

sean_j_roberts