0

Is there a CSS selector to exclude 'display: none' from an element by its inline style attribute value? So i need to write a css selector where 'display: none' is not present.

<div style = "position: absolute; top: 12px; left: 84px; display: none;">

Looking for something like below:

div[not:style * = 'display: none'] 

OR

div:not[style*='display: none'] 

1 Answer 1

1

You're close; you're just missing the parentheses for the not selector:

div:not([style*='display: none']) {}

Note: This is space and case-sensitive. In other words, it will match this:

<div style="display: none"></div>

and this:

<div style="display:None"></div>

You can make it case insensitive by adding an s before the ], and space insensitive by adding another filter:

div:not([style*='display: none' s]):not([style*='display:none' s]) {}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.