Selectors
CSS selectors define the elements to which a set of CSS rules apply.
Basic usage
Universal selector
Selects all elements. The CSS universal selector * matches elements of any type.
<body class="box:border_*">...</body>Class selector
Selects all elements that have the given class attribute.
<div class="text:center.class">...</div>ID selector
Selects an element based on the value of its id attribute.
<div class="text:center#id">...</div>Attribute selector
Selects all elements that have the given attribute.
<div class="text:center[attribute]">...</div>Descendant Combinator
The _ combinator selects nodes that are descendants of the first element.
<div class="text:center_selector2">...</div>Child Combinator
The > combinator selects nodes that are direct children of the first element.
<div class="text:center>selector2">...</div>General Sibling Combinator
The ~ combinator selects siblings. This means that the second element follows the first (though not necessarily immediately), and both share the same parent.
<div class="text:center~selector2">...</div>Adjacent Sibling Combinator
The + combinator matches the second element only if it immediately follows the first element.
<div class="text:center+selector2">...</div>References
Pseudo-classes
The : pseudo allow the selection of elements based on state information that is not contained in the document tree.
Pseudo-elements
The :: pseudo represent entities that are not included in HTML.