Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap
The CSS :has selector is amazing! In this CSS tutorial, we will look at how to use the CSS :has selector and practical examples of how the :has selector can improve web development.
Become a full-stack web dev with Zero To Mastery Courses:
- Advanced React: https://bit.ly/AdvReactDev
- The Complete Web Developer: https://bit.ly/WebDevMaster
- Junior to Senior Dev Roadmap: https://bit.ly/WebDevRoadmap-JrtoSr
Subscribe https://bit.ly/3nGHmNn
Course Updates https://courses.davegray.codes/
Questions - Please post them to my Discord https://discord.gg/neKghyefqh
Buy Me A Coffee https://www.buymeacoffee.com/davegray
Follow Me On Social Media:
Github: https://github.com/gitdagray
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/
Source Code: https://github.com/gitdagray/css-has-selector
React Suspense & React Error Boundaries with SWR
(00:00) Intro
(00:10) Welcome
(00:33) Starter Code & Set up
(02:00) Forward vs Reverse Selections
(04:13) Selections Based on Child Elements
(06:49) Does :not :has selections
(07:44) :has either = OR selections
(08:40) AND selections
(09:48) :has specificity note
(10:17) A more complex example
(11:56) Nav Menu example
(16:05) Modal example
(17:13) light & dark mode example
(18:53) Bubbles example
(20:32) Input Validation example
(25:17) CanIUse.com - :has() support
Tutorial References:
MDN: :has() selector: https://developer.mozilla.org/en-US/docs/Web/CSS/:has
Was this CSS :has selector tutorial helpful? If so, please share. Let me know your thoughts in the comments.
#css #has #selector