In-Depth Guide to CSS Parent Selector :has() @CSSWeekly
In-Depth Guide to CSS Parent Selector :has()  @CSSWeekly
Uploaded April 2022 | Updated September 2026, 2 hours ago
Learn how :has() pseudo-class works and how it can help you create complex UI interactions without tweaking HTML or using JavaScript.

Additionally, find out how you can use :has() to create a fascinating hover effect that would otherwise be impossible without quite a lot of JavaScript.

🎨 Codepen Demos
Staircase Effect: codepen.io/ZoranJambor/pen/vYpzGwV/afd64fbfcc0e617c25e09a1b5d777795
Code Demo: codepen.io/ZoranJambor/pen/eYyLyZL/210fb67ac7d8a67daa64ebfe4b16fd53

πŸ“š Resources on :has()
MDN entry: developer.mozilla.org/en-US/docs/Web/CSS/:has
Can I Use: caniuse.com/?search=has

πŸ”₯ Start Using color-scheme CSS Property πŸ‘‰ youtu.be/nQzRTsjBXfQ

πŸ“– Chapters
00:00 Intro
00:27 How :has() works
03:40 How to select a previous sibling
04:55 Combining :has() with :not()
05:37 How to test if a browser supports :has()
06:19 Create a staircase hover effect
09:00 Conclusion

Subscribe to CSS Weekly Newsletter:
πŸ’Œ css-weekly.com

Keep up-to-date with CSS Weekly:
πŸ‘‰ Twitter: twitter.com/CSSWeekly
πŸ‘‰ Instagram: instagram.com/cssweekly
πŸ‘‰ Facebook: facebook.com/CSSWeekly

Keep up to date with what I'm up to:
πŸ”— Blog: zoranjambor.com
πŸ‘‰ Twitter: twitter.com/zoranjambor
πŸ‘‰ LinkedIn: linkedin.com/in/zoranjambor

- Zoran Jambor
#css
In-Depth Guide to CSS Parent Selector :has()Frontend News #18: Self-Destructing CSS, Throttle Specific Requests In Chrome DevToolsIntroducing Baseline Status for VideoFrontend News #19: CSS overscroll-behavior, scrollbar-gutter, text-grow Properties, & MoreFrontend News #14: paint-order, border-image, Properly Sizing ImagesEnforce Underlined Links in FirefoxUse Firefox DevTools when working with CSS clip-path #devtools #cssHow To Debug Chrome for Android With Android StudioIs This CSS or TypeScript?How Position Absolute Works in CSS GridVisBug - Visual Prototyping in BrowserIntroducing YouTube Channel Visualizer
CSS Weekly |

In-Depth Guide to CSS Parent Selector :has()

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER