Selector API - Selector Group (OR,Union)

> (World Wide) Web - (W3|WWW) > Selector API

1 - About

selector can be grouped to form another selector on a union level with a comma.

Example: selector a or selector b

a, b

You can make an intersection (and) on a attribute level.

On a element level, it has no sense to want to select the element A and the element B as it will always never return any node in the tree.

Example: The element E with the attribute att that has the value foo and the attribute att2 that has the value bar

E[att=foo][att2=bar]]
Advertising

3 - Example

An union or an or is accomplished be separating the selector by a comma.

Example: .a, .b

#IdName, .className  { color:blue; }
  • The HTML
<div id="IdName">The blue color CSS style will be applied on this text</div>
<div class="className">and also on this one</div>
  • The result: