June 14th, 2021

Here’s how to use the new :has selector in @TailwindCSS. This also shows how you can use older pseudo-classes like :nth-child and :nth-of-type in Tailwind (and it applies to using the adjacent sibling selector too):

You can’t.

51° N , 0° E

Also on Twitter

Reply Retweet Favourite

Responses

Sara Soueidan

I’ve been eagerly waiting for the day CSS will be so good that frameworks will have a hard time competing with it. Seems that we’re almost there.

Sara Soueidan

But how is that possible I mean CSS isn’t even a programming language

Sara Soueidan

On second thought: why would you wanna use these selectors at all? We all know CSS best practices don’t work so these must be just as useless. We don’t need them! (I’m sorry. I had to.)

Andy Bell

hell yeh. I can’t imagine an atomic library being of any use for container queries etc

# Posted by Andy Bell on Monday, June 14th, 2021 at 4:01pm

Andy Bell

thanks for using your platform to ruin my day 🥰

# Posted by Andy Bell on Monday, June 14th, 2021 at 4:05pm

Gavin

So much for hate and tailwind right now ( and ppl thinking they are being funny when they are not). It isn’t meant to solve everything. People need to get off their high horse. It’s a utility ‘first’ framework. First being the operative word.

# Posted by Gavin on Monday, June 14th, 2021 at 4:09pm

matt rothenberg

lol I get this is a dig, but it’s silly how much of the discourse around Tailwind is stuck in the technical weeds and ignores the fact that it enables devs and their teams to move swiftly/confidently and is just as legitimate as “vanilla” CSS, shortcomings notwithstanding

Stephanie Eckles

I “learned” last week that some users of The Framework believe it’s providing some extra magic on top of CSS vs compiling to CSS 😬😫 But I’m very much in agreement with you, Sara!

Brandon Cash and 1337 others

.well-actually:nth-child(1) { @apply rounded-lg; } Tailwind isn’t just a list of classes; extract the values if you need the ability to use different selectors. So much hate against Tailwind without understanding its main features. This is literally under “core concepts.”

Mo

Hating on frameworks. So hot right now. Invest!

# Posted by Mo on Monday, June 14th, 2021 at 4:29pm

Tina Bell Vance

I know, I know. Frameworks aren’t for everyone. But I ask you: why would you neuter existing functionality? The new hotness is almost never worth it.

Liam

You can do this in your templating language, because surely you’re using one? Nobody would ever write HTML 🙃

# Posted by Liam on Monday, June 14th, 2021 at 5:17pm

Ranjan

I think all these CSS gurus should practice their vanilla CSS wizardry in their projects and leave us lesser mortals with Tailwind that cuts down time to prod by more than 50% on styling.

# Posted by Ranjan on Monday, June 14th, 2021 at 6:14pm

Yeu-Kang Hua

I defended the CSS community when you got shitted on, and I’ll defend Tailwind whenever I see hate posts like this as well. With the new Just In Time (JIT) engine or utility generator tools, you could create selectors on the fly like: <div class=”has-[img]:bg-black”></div>

Dan Beeston

From what I understand pure CSS can’t use it either because it doesn’t have any browser support yet. Right?

Ranjan

Here is how you can use the latest ‘:has’ selector in your favorite browser. ….. You can’t.

# Posted by Ranjan on Monday, June 14th, 2021 at 10:33pm

Justineo

Though Tailwind isn’t my favorite way to styling stuff, it’s clearly possible to use it together with plain CSS. 😅

# Posted by Justineo on Tuesday, June 15th, 2021 at 12:27am

Zac Wasielewski

Sure you can, they go in your CSS file, alongside your Tailwind includes. There’s no such thing as “in @TailwindCSS”—it’s a complement to CSS, not a replacement for it.

Fatih Kalifa

I mean tailwind is not for me as well, but this take is weird 🤷‍♂️ I think web is the only frontend with the unhealthy obsession over “vanilla”. iOS/android only hates cross platform framework, but not framework in general.

FλL-D1

Its Tailwind is just framework? If not work with Tailwind, may be we just use vanilla CSS? Tailwind is utility-first. No one force to use only utility. 🤔 Tailwindcss support to write with vanilla css, right?

# Posted by FλL-D1 on Tuesday, June 15th, 2021 at 5:55am

Matija Marohnić

I’m using Tailwind, but every time I have to select all even/odd elements I have no idea what to do, so I throw my laptop into a lake and buy a new one. Tailwind explodes if it finds any custom CSS, so your best bet is to try to disarm it, but be careful about which wire to cut.

23 Shares

# Shared by TailwindCSS Bot on Monday, June 14th, 2021 at 3:54pm

# Shared by Sara Soueidan on Monday, June 14th, 2021 at 3:56pm

# Shared by Andy Bell on Monday, June 14th, 2021 at 3:57pm

# Shared by Christian Walter ©️ on Monday, June 14th, 2021 at 3:59pm

# Shared by Felix Häberle on Monday, June 14th, 2021 at 4:00pm

# Shared by kogut benoit on Monday, June 14th, 2021 at 4:01pm

# Shared by SETEC Astrology on Monday, June 14th, 2021 at 4:01pm

# Shared by Baldur Bjarnason on Monday, June 14th, 2021 at 4:03pm

# Shared by Kamen Naydenov on Monday, June 14th, 2021 at 4:08pm

# Shared by saumya on Monday, June 14th, 2021 at 4:10pm

# Shared by Niaccurshi on Monday, June 14th, 2021 at 4:12pm

# Shared by Abū Wān Al-Kenobī on Monday, June 14th, 2021 at 4:21pm

# Shared by Ahmad Shadeed on Monday, June 14th, 2021 at 4:31pm

# Shared by Marc Perrien on Monday, June 14th, 2021 at 4:42pm

# Shared by Ritik on Monday, June 14th, 2021 at 5:07pm

# Shared by Thomasorus on Monday, June 14th, 2021 at 7:22pm

# Shared by Old Man Vandehey on Monday, June 14th, 2021 at 8:51pm

# Shared by Amber Weinberg Jones (She/Her) on Monday, June 14th, 2021 at 9:34pm

# Shared by Josh Tumath on Monday, June 14th, 2021 at 11:25pm

# Shared by Jens Tangermann on Tuesday, June 15th, 2021 at 8:15pm

# Shared by Mem's on Tuesday, June 15th, 2021 at 10:29pm

# Shared by Clearleft on Wednesday, June 16th, 2021 at 8:05am

# Shared by Michael Fürstenberg on Wednesday, June 16th, 2021 at 5:52pm

144 Likes

# Liked by Anton Andreasson Gistedt on Monday, June 14th, 2021 at 4:01pm

# Liked by citrus on Monday, June 14th, 2021 at 4:01pm

# Liked by Erik Kroes 🏔 on Monday, June 14th, 2021 at 4:01pm

# Liked by TailwindCSS Bot on Monday, June 14th, 2021 at 4:01pm

# Liked by Philipp on Monday, June 14th, 2021 at 4:01pm

# Liked by Andy Bell on Monday, June 14th, 2021 at 4:01pm

# Liked by Christian Walter ©️ on Monday, June 14th, 2021 at 4:01pm

# Liked by Lee Fisher on Monday, June 14th, 2021 at 4:01pm

# Liked by Sara Soueidan on Monday, June 14th, 2021 at 4:01pm

# Liked by Felix Häberle on Monday, June 14th, 2021 at 4:01pm

# Liked by Erik Vorhes on Monday, June 14th, 2021 at 4:01pm

# Liked by Joshua @ZeldaUniverse on Monday, June 14th, 2021 at 4:01pm

# Liked by Chris Perry 🇪🇺 on Monday, June 14th, 2021 at 4:01pm

# Liked by Luke Bonaccorsi 🏳️‍🌈 on Monday, June 14th, 2021 at 4:01pm

# Liked by Paulo Henrique on Monday, June 14th, 2021 at 4:01pm

# Liked by Jason Neel on Monday, June 14th, 2021 at 4:01pm

# Liked by Jethro May on Monday, June 14th, 2021 at 4:01pm

# Liked by Brett Evans on Monday, June 14th, 2021 at 4:01pm

# Liked by 妖怪 👺 on Monday, June 14th, 2021 at 4:01pm

# Liked by jackomono on Monday, June 14th, 2021 at 4:02pm

# Liked by dan e on Monday, June 14th, 2021 at 4:02pm

# Liked by Mohamad Bo Hamad on Monday, June 14th, 2021 at 4:02pm

# Liked by Sérgio Fontes on Monday, June 14th, 2021 at 4:38pm

# Liked by Valentino Gagliardi on Monday, June 14th, 2021 at 4:38pm

# Liked by Steven Jarvis on Monday, June 14th, 2021 at 4:38pm

# Liked by Corey Mwamba on Monday, June 14th, 2021 at 4:38pm

# Liked by Patrick Connors on Monday, June 14th, 2021 at 4:38pm

# Liked by George Hieron on Monday, June 14th, 2021 at 4:38pm

# Liked by Douglas Campbell on Monday, June 14th, 2021 at 4:38pm

# Liked by Tayyab on Monday, June 14th, 2021 at 4:38pm

# Liked by Cliff Williams on Monday, June 14th, 2021 at 4:38pm

# Liked by under his eye on Monday, June 14th, 2021 at 4:38pm

# Liked by dies das 🦂 content on Monday, June 14th, 2021 at 4:38pm

# Liked by Mark Robbins on Monday, June 14th, 2021 at 4:38pm

# Liked by Shaw on Monday, June 14th, 2021 at 4:38pm

# Liked by Sven Wolfermann on Monday, June 14th, 2021 at 4:38pm

# Liked by João Gabriel on Monday, June 14th, 2021 at 4:38pm

# Liked by Trey Piepmeier on Monday, June 14th, 2021 at 4:38pm

# Liked by Josh Humble || Design on Monday, June 14th, 2021 at 4:39pm

# Liked by Már Örlygsson 🔵 on Monday, June 14th, 2021 at 4:39pm

# Liked by Batbayar B. on Monday, June 14th, 2021 at 4:39pm

# Liked by Life? Don't talk to me about life... on Monday, June 14th, 2021 at 4:39pm

# Liked by Joschi Kuphal 吉 on Monday, June 14th, 2021 at 4:39pm

# Liked by kogut benoit on Monday, June 14th, 2021 at 4:39pm

# Liked by Stephanie Eckles on Monday, June 14th, 2021 at 4:39pm

# Liked by henry ✷ on Monday, June 14th, 2021 at 4:39pm

# Liked by Bram Smulders on Monday, June 14th, 2021 at 4:39pm

# Liked by Karim Jordan on Monday, June 14th, 2021 at 4:39pm

# Liked by Baldur Bjarnason on Monday, June 14th, 2021 at 4:39pm

# Liked by Alistair Shepherd on Monday, June 14th, 2021 at 4:39pm

# Liked by Megan on Monday, June 14th, 2021 at 4:39pm

# Liked by Ethan Marcotte on Monday, June 14th, 2021 at 4:39pm

# Liked by Fab || Student🧕💻 on Monday, June 14th, 2021 at 4:39pm

# Liked by Caspar Hübinger on Monday, June 14th, 2021 at 4:39pm

# Liked by ☯Evil Jim O'Donnell on Monday, June 14th, 2021 at 4:39pm

# Liked by Abdullah Yousúf on Monday, June 14th, 2021 at 4:39pm

# Liked by Niaccurshi on Monday, June 14th, 2021 at 4:39pm

# Liked by Matthias Ott on Monday, June 14th, 2021 at 4:39pm

# Liked by Chriztian Steinmeier on Monday, June 14th, 2021 at 4:39pm

# Liked by San ᶘಠᴥಠᶅ 정산이 on Monday, June 14th, 2021 at 4:39pm

# Liked by theAdhocracy on Monday, June 14th, 2021 at 4:39pm

# Liked by /dev/faisal on Monday, June 14th, 2021 at 4:39pm

# Liked by Abū Wān Al-Kenobī on Monday, June 14th, 2021 at 4:39pm

# Liked by Andrew Aquino on Monday, June 14th, 2021 at 4:39pm

# Liked by Daniel Ehniss on Monday, June 14th, 2021 at 4:39pm

# Liked by Rafael Calvo 🔰 on Monday, June 14th, 2021 at 5:46pm

# Liked by Jeff Putnam on Monday, June 14th, 2021 at 5:46pm

# Liked by Aaron Whitman on Monday, June 14th, 2021 at 5:46pm

# Liked by cris on Monday, June 14th, 2021 at 5:46pm

# Liked by Mark Norman Francis on Monday, June 14th, 2021 at 5:46pm

# Liked by Kumar Harsh 🐺 on Monday, June 14th, 2021 at 5:46pm

# Liked by Stephan Meijer on Monday, June 14th, 2021 at 5:46pm

# Liked by i am schulz on Monday, June 14th, 2021 at 5:46pm

# Liked by Harry Llewelyn on Monday, June 14th, 2021 at 5:46pm

# Liked by ✨ Lawrie ✨ on Monday, June 14th, 2021 at 5:46pm

# Liked by Derek Odegard on Monday, June 14th, 2021 at 5:46pm

# Liked by janette ヽ(• ᴗ •)ノ on Monday, June 14th, 2021 at 5:46pm

# Liked by Mark on Monday, June 14th, 2021 at 5:46pm

# Liked by 🏴󠁧󠁢󠁷󠁬󠁳󠁿 Emyr Thomas on Monday, June 14th, 2021 at 5:46pm

# Liked by Bart van de Biezen on Monday, June 14th, 2021 at 5:46pm

# Liked by forsythia on Monday, June 14th, 2021 at 5:46pm

# Liked by Facundo Corradini on Monday, June 14th, 2021 at 5:46pm

# Liked by Tina Bell Vance on Monday, June 14th, 2021 at 5:46pm

# Liked by Selena Strain on Monday, June 14th, 2021 at 5:46pm

# Liked by jake albaugh on Monday, June 14th, 2021 at 5:46pm

# Liked by Josh Brown on Monday, June 14th, 2021 at 5:46pm

# Liked by 𝙅𝙚𝙛𝙛 🐟 on Monday, June 14th, 2021 at 5:46pm

# Liked by altin on Monday, June 14th, 2021 at 5:46pm

# Liked by Dominik Schwind on Monday, June 14th, 2021 at 5:46pm

# Liked by Colin Johnston on Monday, June 14th, 2021 at 5:47pm

# Liked by Sid Vishnoi on Monday, June 14th, 2021 at 5:47pm

# Liked by Andrea Magnabosco on Monday, June 14th, 2021 at 5:47pm

# Liked by 🅰️ on Monday, June 14th, 2021 at 5:47pm

# Liked by Benjamin Turner on Monday, June 14th, 2021 at 5:47pm

# Liked by Claudio Rimann on Monday, June 14th, 2021 at 5:47pm

# Liked by Horace Keung on Monday, June 14th, 2021 at 6:53pm

# Liked by Riad on Monday, June 14th, 2021 at 6:53pm

# Liked by Omar Mokhtar 🇲🇾🇵🇸 on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Clearleft on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Ivan Jonas Gomes on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Stephanie Stimac 🔮 Web Witch on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Wim Van Aerschot on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Daniel on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Paula Penedo on Wednesday, June 23rd, 2021 at 6:24am

# Liked by MGquadro Web Agency on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Anthony😷 on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Daniel Gunnarsson on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Lucia Gonzalez on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Ben Seven on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Scott McKee on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Peter Antonius on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Christian Alden Jacobs on Wednesday, June 23rd, 2021 at 6:24am

# Liked by S. M. Abdul Aziz on Wednesday, June 23rd, 2021 at 6:24am

# Liked by pudymody on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Kevin McMillin on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Amber Weinberg Jones (She/Her) on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Mark Hurrell on Wednesday, June 23rd, 2021 at 6:24am

# Liked by Jens Tangermann on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Bastien #Boulbi 😭 on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Mary Cummins on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Old Man Vandehey on Wednesday, June 23rd, 2021 at 6:49am

# Liked by WaporVater on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Matt Bainton on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Mike Aparicio on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Jon Pearse on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Adam Greenough on Wednesday, June 23rd, 2021 at 6:49am

# Liked by jailandrade on Wednesday, June 23rd, 2021 at 6:49am

# Liked by ge ricci on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Ben Frain on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Kunuk Nykjaer on Wednesday, June 23rd, 2021 at 6:49am

# Liked by Gautam Kumar on Wednesday, June 23rd, 2021 at 6:49am

# Liked by FλL-D1 on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Yves Van Broekhoven on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Pete Barr 🤟 on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Holger Bartel on Wednesday, June 23rd, 2021 at 6:50am

# Liked by #DEFUND POLICE on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Jordi Talens on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Anna Erkers on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Priya Unger on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Michael Fürstenberg on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Comandeer on Wednesday, June 23rd, 2021 at 6:50am

# Liked by 𝕰𝖌𝖎𝖑 𝕵. 𝕾𝖜𝖊𝖓𝖓𝖎𝖓𝖌 𝕷𝖊𝖞𝖘𝖊𝖗 on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Sven on Wednesday, June 23rd, 2021 at 6:50am

# Liked by Ferdi on Wednesday, June 23rd, 2021 at 6:50am

Have you published a response to this? :