HTML and CSS Reference
In-Depth Information
Rule Structure
A style sheet consists of one or more rules that describe how page elements should be presen-
ted. Every rulehas two fundamental parts: the selectorand the declarationblock. Figure 1-1
illustrates the structure of a rule.
Figure1-1.Rule structure
On the left side of the rule, we find the selector, which selects the parts of the document to
which the rule should be applied. On the right side of the rule, we have the declaration block.
A declaration block is made up of one or more declarations; each declaration is a combination
of a CSS propertyand a valueof that property.
The declaration block is always enclosed in curly braces. A declaration block can contain sev-
eral declarations; each declaration must be terminated with a semicolon ( ; ). The exception is
the final declaration in a declaration block, for which the semicolon is optional.
Each property, which represents a particular stylistic parameter, is separated from its value
by a colon ( : ). Property names in CSS are not case-sensitive. Legal values for a property are
defined by the property description. Chapter 4 provides details on acceptable values for CSS
properties.
Search WWH ::




Custom Search