Using Multiple Declarations


More 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 Declarations
h1 {     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.





Sams Teach Yourself CSS in 10 Minutes
Sams Teach Yourself CSS in 10 Minutes
ISBN: 0672327457
EAN: 2147483647
Year: 2005
Pages: 234
Authors: Russ Weakley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net