Page 1 of 1

Author CSS "not" operator?

Posted: Sat Feb 26, 2011 6:55 am
by maglid
I want to stop the display in Author mode of an element that does NOT have a certain attribute. I was hoping for something like this but I can't find it in the help:

Code: Select all

/* do not display <myElement myAttribute="..."  */
myElement:not(myAttribute) {
display:none;
}
Is there a negation function like this available?

Thanks,
Mark

Re: Author CSS "not" operator?

Posted: Mon Feb 28, 2011 12:34 pm
by Radu
Hi Mark,

There is no CSS rule to state that an element without a certain attribute should be matched.
But:
There is a CSS rule which states that an element which has a certain attribute should be matched. So if for instance you have the following CSS:

Code: Select all


myElement{
display:inline;
}

myElement[myAttribute]{
display:block;
}
Then for the display property the first selector will be used when the attribute is not found on the element. And the second selector will be used when the attribute is found on the element (because it is more specific).

Regards,
Radu