What css are you trying to get it to write? I would assume hover:before means to check the .my-class:before element https://tailwindcss.com/docs/hover-focus-and-other-states#before-and-after
Sep 30, 2022
11
Level 10
Tailwind question on hover beofre and after
Hi all,
I would like to know if Tailwind has a before and after state when moving the mouse in and out on an element please.
I have tried this but only the hover "on" works, not the hover "out"
<div class="hover:before:animate-fade-in hover:after:animate-fade-out">Hello Laracast!</div>
Tailwind config:
keyframes: {
'fade-in': {
'0%': {
opacity: '0',
},
'100%': {
opacity: '1',
},
},
'fade-out': {
'100%': {
opacity: '1',
},
'0%': {
opacity: '0',
},
},
},
animation: {
'fade-in': 'fade-in 1s',
'fade-out': 'fade-out 1s',
},
},
Any idea why there is no hover-out state please?
Thank you.
Level 102
Try these classes https://play.tailwindcss.com/nqiP4XMsR0
<div class="transition-opacity hover:opacity-100 opacity-0 duration-1000">foo</div>
1 like
Please or to participate in this conversation.