Breaking Boundaries with :has() | The Game Changing CSS Trick

Veröffentlicht am: 02 Januar 2024
auf dem Kanal: Optimistic Web
9,376
911

I have been waiting for a good parent selector for a long time. I mean it. Until now, if I wanted to style a parent based on what it contained, I had to use JavaScript. I thought it was a bit clumsy and overkill. But :has() pseudo-class is here to fix this problem for good.

In this short tutorial, I will teach you how to use parents and siblings selectors in a few lines of CSS. No JavaScript needed! You are only making things harder for yourself if you are still doing this in JavaScript.

Feel free to comment if you have seen any weird use cases for this.

Related topics
-----------------------------------------------------
how to select parent element in CSS ,
how to use parent selector,
how to parent selectors,
parent selectors CSS,
what are parent selectors CSS,
CSS parent selectors tutorial,
parent selectors with CSS

Subscribe and never miss a beat
-----------------------------------------------------
🔔 Subscribe for more videos like this:    / @optimisticweb  

Learn at your own pace
-----------------------------------------------------
HTML -    • Learn HTML to Build Modern Websites  
CSS -    • Level Up Your CSS Skills  
CSS Grid Layout -    • A Complete Guide to Mastering CSS Grid Lay...  
CSS Masking -    • CSS Masks & Creative Effects  
JavaScript -    • JavaScript  

Connect, share, and grow
-----------------------------------------------------
YouTube:    / @optimisticweb  
Bluesky: https://bsky.app/profile/optimisticwe...
X (Twitter):   / optimisticweb  
Instagram:   / optimisticweb  
Facebook:   / optimisticweb  
CodePen: https://codepen.io/optimisticweb

#css #cssselectors #hasselector #csshas #webdevtutorial #csstutorial #csstips #cssshorts #cssforbeginners #csstricks #css3 #learncss #optimisticweb


Auf dieser Seite können Sie das Online-Video Breaking Boundaries with :has() | The Game Changing CSS Trick mit der Dauer online in guter Qualität ansehen, das der Benutzer Optimistic Web 02 Januar 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 9,376 Mal angesehen und es wurde von 911 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!