HTML and CSS Reference
In-Depth Information
</head>
Using the meta element for setting the default style sheet offers a central point at
which the preferred styles on the page can be selected. This opens the possibility of
changing one value dynamically using a server-side script, for instance, based on user
interaction or other variables.
CSS style rules
After attaching a style sheet to a page, you will need to access the HTML elements on
the page and style them. A style rule is code you will create to style parts of the HTML
content. A style rule begins with a selector . Selectors will be covered in more detail in
the next section, but in short, they are a set of rules for selecting the different compon-
ents of an HTML page. The selector is followed by curly brackets ({ and }) that enclose
all the styling information for a particular style rule. Between the brackets are pairs of
CSS properties and values, which taken together are called declarations . To provide
various styling effects, a CSS style rule can have one or more declarations, each termin-
ated with a semicolon. They can, and usually do, span multiple lines. Figure 6-2 sum-
marizes the entire style rule syntax and terminology.
Figure 6-2. The terminology and syntax of a CSS style rule
In the example in Figure 6-2 , the selector is p , which accesses all the paragraph ele-
ments ( p ) on the page; the style declarations then set their background color to red and
 
Search WWH ::




Custom Search