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

Publié le: 02 janvier 2024
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne Breaking Boundaries with :has() | The Game Changing CSS Trick durée online en bonne qualité , qui a été Téléchargé par l'utilisateur Optimistic Web 02 janvier 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 9,376 fois et il a aimé 911 téléspectateurs. Bon visionnage!