Using Multiple DeclarationsMore than one declaration can be used within a declaration block. Each declaration must be separated with a semicolon. In this example, the <h1> and <h2> elements will be styled with a new declarationcolor: navy;. The <h2> element also will be styled with text-align: center;, which will align it in the center of the browser window. The new declarations are highlighted in Listing 2.9. The results are shown in Figure 2.3. Listing 2.9. CSS Code Showing Multiple Declarationsh1 { text-align: center; color: navy; } h2 { font-style: italic; text-align: center; color: navy; } p { color: maroon; } Figure 2.3. Screenshot of elements styled with multiple declarations.
|