O'Reilly logo

Cascading Style Sheets (CSS) by Example by Steve Callihan

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

Controlling the Body of Your Page

In HTML documents, all displayable elements are nested inside of the BODY element (between the <body> start tag and the </body> end tag). By setting a style rule for the BODY element, you can control the global characteristics of your page, such as the page margins, the default font, and the foreground and background colors, for instance.

Setting the Page Margins

Using styles, you can control all four margins on your page. To set the width of all four margins, just type the following bold text:

<style type="text/css">
body {  margin-top: 25px; margin-bottom: 25px; margin-left: 25px; margin-right:
							25px; }
</style>

To check this out in your browser, first resave kochanski.html—in most cases, you can just select ...

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