CSS, How to use Multiple Declarations?

Friday, 31. July 2009

More than one declaration can be used within a declaration block. Each declaration must be separated with a semicolon.

In this CSS, How To Tutorial the h1 and h2 elements will be styled with a new declaration. {color: navy;} The h2 element will also be styled with {text-align: center;} which will align it in the center of the browser window.

HTML Code

<h1> CSS Headings One</h1>
<h2> CSS Heading Two</h2>
<p> Some text about your css tutorial would go here</p>

CSS Code

h1 {
text-align: center;
color: navy;
}
h2 {
font-style: italic;
text-align: center;
color: navy;
}