CSS reference - CSS: Cascading Style Sheets | MDN (original) (raw)
style-rule ::= selectors-list { properties-list }
Where:
selectors-list ::= selector[:pseudo-class] [::pseudo-element] [, selectors-list]
properties-list ::= [property : value] [; properties-list]
See the index of selectors, pseudo-classes, and pseudo-elements below. The syntax for each specified value depends on the data type defined for each specified property.
Style rule examples
strong {
color: red;
}
div.menu-bar li:hover > ul {
display: block;
}
For a beginner-level introduction to the syntax of selectors, see our guide on CSS Selectors. Be aware that any syntax error in a rule definition invalidates the entire rule. Invalid rules are ignored by the browser. Note that CSS rule definitions are entirely (ASCII) text-based, whereas DOM-CSS / CSSOM (the rule management system) is object-based.