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

Опубликовано: 02 Январь 2024
на канале: 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


На этой странице сайта вы можете посмотреть видео онлайн Breaking Boundaries with :has() | The Game Changing CSS Trick длительностью online в хорошем качестве, которое загрузил пользователь Optimistic Web 02 Январь 2024, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 9,376 раз и оно понравилось 911 зрителям. Приятного просмотра!