user image

Jo Micheal
Published in : 2022-07-25

Multiple classes in :not() function in CSS

HTML & CSS

Hello everyone,
How can I use :not with multiple classes? I am trying 

div:not(.light, .dark){/* CSS code */}

and it's not working, any suggestions?   

Comments

Mohamed Atef Date : 2022-07-25

Best answers

51

Best answers

51

You can use it like this and it will work with you

div:not(.light):not(.dark){/* CSS code */}

Jo Micheal Date : 2022-07-25

Thanks this works 

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Invalid CSS after : expected expression was - SASS error
Publish date: 2022-02-13 | Comments: 1

Tag: HTML & CSS

Flex Box last column break to the next row
Publish date: 2022-02-10 | Comments: 1

Tag: HTML & CSS

Is OOCSS still a good CSS architecture in 2022?
Publish date: 2022-02-08 | Comments: 2

Tag: HTML & CSS

How to horizontally align to the centre a li inside an ul?
Publish date: 2022-03-04 | Comments: 2

Tag: HTML & CSS

Searching for a better way to use abstracts in Dart SASS
Publish date: 2022-02-10 | Comments: 0

Tag: HTML & CSS

How to align an Textarea in the middle of the webpage
Publish date: 2022-02-27 | Comments: 1

Tag: HTML & CSS

Sticky header goes behind the Images
Publish date: 2022-02-10 | Comments: 1

Tag: HTML & CSS

How to separate the background into three divs that can be flipped?
Publish date: 2022-02-12 | Comments: 1

Tag: HTML & CSS