Book Home Saturday 01st of November 2014 08:55:03 AM Cascading Style Sheets: The Definitive GuideSearch this book

Full Text Search

H1 {margin: 0.25in; background-color: silver;}
Figure 7-6

Figure 7-6. Setting a margin for H1 elements

This sets a quarter-inch of blank space on each side of anH1 element. In Figure 7-6, thisis represented using dashed lines which are included for illustrativepurposes. These lines would not actually appear in a web browser.

margin can accept any length measure, whether inpixels, inches, millimeters, or ems. However, the default value for WIDTH = 600 HEIGHT = 360 >

If you are having difficulty searching, or if you have not used this search utility before, please read this.


Library Navigation Links

Copyright © 2002 O'Reilly & Associates, Inc. All Rights Reserved.

P {margin-left: auto; margin-right: 100px; width: 100px;} 

The results are shown in Figure 8-11.

Figure 8-11

Figure 8-11. Automatic left margin

In a sense, auto can be used to say, "make up the difference between everything else and the required total." However, what if all three of these properties are set to 100px , and none of them to auto ?

In the case where all three properties are set to something other

Figure 8-43

Figure 8-43. The details of floating up and left with negative margins

The math in this situation works out something like this: assume the top inner edge of the DIV is at the pixel position 100. The browser, in order to figure out where the top inner edge of the floated element should be will do this: 100px + (-15px) margin + 0 padding = 85px . Thus the top inner edge of the floated