Let’s say I have a h1 tag like this:
<h1 data-position="left" class="data-[position=mid]:animate-fade-out">content</h1>
How can I use tailwind(maybe with some not operator based on my last search results but I still don’t know how) to do animate-fade-in
when position
is not equal to mid
?
There are three general choices on position attribute: left
, right
and mid
2
Answers
The closest that I could get to was something like this:
Which
$=
is an attribute selector and works when the attribute data value ends with that letter 't' and I did that because there are three general choices onposition
attribute:left
,right
andmid
As it is obvious theleft
andright
words end int
so I can enable and disable different animations based on that.I'm sure there is a better way and if you know it, I'll be pretty happy to know that.
You can do it like this:
Check out this playground