Skip to content

How to generate :has utilities in TW4? #16655

Answered by wongjn
smhmd asked this question in Help
Discussion options

You must be logged in to vote

Yep!

<html class="has-[.html-bg-red-500]:bg-red-500">

Or you could even style the <html> element from <main> like:

<html><main class="[html:has(&)]:bg-red-500">

You could then abstract this to a variant, if you wanted, like:

@custom-variant html (html:has(&));
<main class="html:bg-red-500">

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@smhmd
Comment options

Answer selected by smhmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants