Issue
Let's say I want all the links inside white card to be black, and all the links inside orange cards to be white. I can easily do in pure CSS:
.card--primary {
background-color: white;
a {
color: black
}
}
.card--danger {
background-color: orange;
a {
color: white;
}
}
But how can I achieve similar behaviour using Tailwind (or other CSS utility frameworks)?
Solution
This is possible in tailwind 3.1 with the addition of the arbitrary variants feature. The way you would do this is by using a selector on the parent div:
<div className="card--primary bg-white [&>a]:text-black" >
<a/>
<a/>
<div/>
<div className="card--danger bg-orange [&>a]:text-white" >
<a/>
<a/>
<div/>
Answered By - OneTuskedMario
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.