meta_pixel
Tapesearch Logo
Log in
Syntax - Tasty Web Development Treats

I can has() new CSS Selector?!

Syntax - Tasty Web Development Treats

Wes Bos

Tech News, News, Technology

4.91.2K Ratings

🗓️ 13 June 2022

⏱️ 25 minutes

🧾️ Download transcript

Summary

In this Hasty Treat, Scott and Wes talk about new CSS selectors :has, :where, and :is. MagicBell - Sponsor MagicBell is the the notification inbox for your product. Add a MagicBell to your product for announcements, billing, workflow, and other notifications. The free plan supports up to 100 Monthly Active Users - use the coupon code SYNTAXFM for 10% off the first 12 months. LogRocket - Sponsor LogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It’s an exception tracker, a session re-player and a performance monitor. Get 14 days free at logrocket.com/syntax. Show Notes 00:25 Welcome 01:19 Sponsor: MagicBell 02:31 Sponsor: LogRocket 03:40 Don’t say stupid 05:03 :Has MDN :Has // Finds all p tags that have an anchor tag as a child p:has(a) {} // Can find children of parent as well // Finds the button of a paragraph that contains an a tag p:has(a) button {} // Finds all p tags that don't have an anchor tag as a child p:not(:has(a)) {} // Finds all p tags where a is a direct sibling p:has(> a) {} // would find Hi // would not find hi 06:13 Jargon check 11:01 Some examples 13:25 Nest navigations 13:51 Can I use it? 15:52 Is and Where MDN :where In the past we would write header p:hover, main p:hover, footer p:hover { color: red; cursor: pointer; } :where is essentially a short had for making this easier considering the 2nd half of these selectors is the same. Will make your css dryer :where(header, main, footer) p:hover {} Also super handy in avoiding css blocks being ignored for unsupported features. // Doesn't work div:has(p), div:some_new_selector(p) // Will still work for :has if has is supported :where(div:has(p), div:some_new_selector(p)) When to use :Where Tweet us your tasty treats Scott’s Instagram LevelUpTutorials Instagram Wes’ Instagram Wes’ Twitter Wes’ Facebook Scott’s Twitter Make sure to include @SyntaxFM in your tweets

Transcript

Click on a timestamp to play from that location

0:00.0

Monday! Monday! Monday! Open wide dev fans! Get ready! To stuff your face with

0:07.0

JavaScript CSS! Node modules! Barbecue tips! Get workflow! Break dancing! Soft skills!

0:12.0

Web development! The hastiest! The craziest! The tastiest! Web development

0:17.0

treats! Coming in hot! Here is Wes Barakuda! Boss and Scott El Torro Lugo!

0:24.0

Tolinsky!

0:27.0

Welcome to Zintax! On this Monday hasty treat! We're going to be talking about

0:32.0

some new CSS selector, some of which you can use today, some of which you can't

0:36.0

and some of which we've been waiting for these things for a long time. I'm talking

0:40.0

about has wherein is. These things are going to really allow us to write

0:45.0

some cleaner CSS and do some things that we've never been able to do before

0:49.0

in the history of CSS. My name is Scott Tolinsky. I'm a developer from Denver,

0:54.0

Colorado, and with me today, as always, is Wes Boss. Everybody, I excited about

1:01.0

this new has selector. Yeah, me too. Who's not excited for has selector?

1:05.0

I'll tell you, the only people who aren't excited for the has selector are the

1:09.0

people who have not heard about what it can do. So before we get into has,

1:14.0

let's get into two of our amazing sponsors today. That is Magic Bell and

1:19.0

Log Rocket. Yeah, Magic Bell. It's a notification inbox for your

1:24.0

product, for your app, for whatever you call it. If you add Magic Bell to your

1:28.0

product, you can get announcements, billing, workflow, other notifications.

1:32.0

That's kind of cool because if you think about how hard it is to integrate

1:37.0

notifications into your app, you might think super simple. I'll just have an

1:41.0

array of notifications and put push into that array when the person needs

...

Please login to see the full transcript.

Disclaimer: The podcast and artwork embedded on this page are from Wes Bos, and are the property of its owner and not affiliated with or endorsed by Tapesearch.

Generated transcripts are the property of Wes Bos and are distributed freely under the Fair Use doctrine. Transcripts generated by Tapesearch are not guaranteed to be accurate.

Copyright © Tapesearch 2026.