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

Publicado em: 02 Janeiro 2024
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line Breaking Boundaries with :has() | The Game Changing CSS Trick duração online em boa qualidade , que foi baixado pelo usuário Optimistic Web 02 Janeiro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 9,376 vezes e gostou 911 espectadores. Boa visualização!