O'Reilly logo

Microsoft® HTML5 Step by Step by Faithe Wempen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Formatting Divisions

You format divisions as you would any other elements. You can use styles to specify the font family, font style, font weight, alignment, color, and everything else covered so far in this book.

You can change the background color of a division with the background-color style rule. For example, to add a khaki-colored background to the navigation bar, use the following:

nav {float: left; width: 150px; padding-top: 15px; background-color: khaki}

When you start applying colors to divisions, however, you might uncover some underlying problems with your page. For example, the page for The Garden Company from the previous example looks pretty good when everything has a white background, but watch what happens when you add that khaki ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required