CSS :is(),:where(),:has() and :not()

Read Time:2 Minute, 9 Second

Hello Guys today i will be discussing about some new Css pseudo class selectors

Note – Before using these selectors check out their browser support at
https://caniuse.com/

Let’s get started…

Enter fullscreen mode Exit fullscreen mode
  • :is() – Sometimes you have to provide the same styling to multiple elements , so you might do it like this

Enter fullscreen mode Exit fullscreen mode

It creates a chaining and sometimes can be long enough, but with :is() selector , now you can do it like this

Enter fullscreen mode Exit fullscreen mode

NOTE – remember to give a space before the :is() selector always if you are using it with a parent element like above.

  • :where() – This selector also works same as :is(), the difference lies in the specificity, :is() takes the specificity of the elements which has higghest specificity in the group, :where() has a 0 specificity no matter how many elements grouped together

Enter fullscreen mode Exit fullscreen mode

NOTE – remember to give a space before the :where() selector always if you are using it with a parent element like above.

  • :has() – This selector simply checks the presence of some element using its class , Id , tagName etc.

Enter fullscreen mode Exit fullscreen mode

Enter fullscreen mode Exit fullscreen mode

It will check whether the parent element has an input with type checkbox and it is checked , if it is checked , the color of p tag will be red , else it will be default black.

NOTE – In case of :has() you don’t need to provide a space before it , you can see it in the example above

  • :not() – This selector is used to style all the elements except the one which is inside the parameter of :not()

Enter fullscreen mode Exit fullscreen mode

NOTE – remember to give a space before the :not() selector always if you are using it with a parent element like above.

THANK YOU FOR CHECKING THIS POST

You can contact me on –
Instagram – https://www.instagram.com/supremacism__shubh/
LinkedIn – https://www.linkedin.com/in/shubham-tiwari-b7544b193/
Email – [email protected]

^^You can help me by some donation at the link below Thank you👇👇 ^^
☕ –> https://www.buymeacoffee.com/waaduheck <–

Also check these posts as well
https://dev.to/shubhamtiwari909/js-push-and-pop-with-arrays-33a2/edit

https://dev.to/shubhamtiwari909/tostring-in-js-27b

https://dev.to/shubhamtiwari909/join-in-javascript-4050

https://dev.to/shubhamtiwari909/going-deep-in-array-sort-js-2n90

Source: https://dev.to/shubhamtiwari909/css-iswherehas-and-not-2afd

WP Ad Inserter plugin for WordPress

Tag Cloud

Java Java Logical Programs OTP Generation in Java python Recursion youtube video ASCII Upper and Lower Case blockchain javascript graph learn to code software development Successful Software Engineers breadth first search Java Array Programs Java Programs Uncategorized android ios programming kotlin web-development django data sql cybersecurity database swiftui serverless aws swift rust react background-position gradients loader mask grid nth-child pseudo elements indieweb WordPress Print Array without brackets C++ factorial Java String Programs Final Keyword Static Variable Axie Infinity Cryptokitties NFT games tool inserting MISC Tips Codes python code python projects python3 system info python project Bigginers How to Do Integrations Payment Gateways PHP checkout page in php Implement stripe payment gateway in Step by step in PHP integrate stripe gatway in php mysql payment gateway integration in php step by step payment gateway integration in php step by step with source code payment gateway integration in website PHP Integrate Stripe Payment Gateway Tutorial PHP shopping cart checkout code shopping cart in php stripe php checkout PHP/MySQL/JSON best international payment gateway does google pay accept international payments how to accept international payments in india paytm payment gateway razorpay codeigniter github razorpay custom checkout github razorpay get payment details razorpay integration in codeigniter github razorpay international payments Razorpay payment gateway integration in CodeIgniter razorpay payment gateway integration in php code Razorpay payment gateway integration with PHP and CodeIgniter Razorpay payment gateway setup in CodeIgniter Library & Frameworks Tips & Tricks UI/UX & Front-end coding birds online html code for google sign in login with google account in PHP login with google account using javascript login with google account using javascript codeigniter login with google account using php login with google account using php source code
WP Migrate 2.5 Released: High-Performance File Transfers for All Previous post WP Migrate 2.5 Released: High-Performance File Transfers for All
Apple Messages & Color Contrast Next post Apple Messages & Color Contrast

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.