This webpage is updated by Len Hom on March 5, 1999

Len's Style Sheet 2 - Setting Margins

Setting Page Margins

You can set the left and right margins with the " margin-left " and " margin-right " properties, i.e.

< STYLE type= "TEXT/CSS" >
BODY { margin-left: 20%; margin-right: 20%; }
< /STYLE >


The " margin-top " property specifies the space above and below headings and paragraphs, etc. and the " margin-bottom " property specifies the space below. To set these for all H2 headings, you can write:

H2 { margin-top: 3em; margin-bottom: 2em }

To specify the space above a particular heading, you need to create a named style for the heading. You do this with the CLASS attribute in the markup, i.e.

< H2 CLASS= " subsection " > Setting Margins </H2>

The style rule is then written as:

H2.subsection { margin-top: 3em; margin-bottom: 2em; }

If you have any comments or questions, please send email to:

Len Hom


Back [Back Button] Next [Next Button] Return to Beginning of Page


I take full responsibility for the information posted. The information on this page represents that of myself and not that of California State University, Sacramento or the School of Engineering and Computer Science