Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS selector, multiple attributes, OR operator

I need your help with CSS selectors. Imagine a style HTML tag:

<style type="text/css">
[...selector...] {color:red;}
</style>

I would like to construct a selector with multiple attributes and logical operators. But I didn't found the correct syntax.

My requirement:
The selector should find elements, which have a 'property' attribute and this 'property' attribute equals some URL. The second condition: the elements should have a 'resource' OR 'typeof' attribute (it isn't importent, what are the values).

So I need this logical structure: A = some URL && (B || C), and it must be in one selector.
How to do this?

like image 501
Petr Dušek Avatar asked Sep 10 '13 10:09

Petr Dušek


1 Answers

You will need to repeat the property attribute selector for each OR condition, combining each one with the second attribute selector like so:

[property="some URL"][resource], [property="some URL"][typeof] { color: red; }

Reference: http://www.w3.org/TR/css3-selectors/#attribute-selectors

like image 174
BoltClock Avatar answered Sep 26 '22 05:09

BoltClock