• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Box Properties > margin-left Property

12.33. margin-left Property

The margin-left property is used to add space between the browser window and an onscreen element. In terms of functionality, it is equivalent to the padding sub-family of properties, but the padding properties are meant to set the spacing between the border and the content of a box-level element, or set relative spacing between two or more elements. The margin sub-family of properties instead sets the space between the browser window and a given box property, such as a paragraph, header or image. The difference between the margin set of properties and padding properties is that the margin sets the spacing value outside of the box, whereas the padding set of properties sets the spacing value inside the boundaries of the box. While they are designed for different purposes, the two sets of properties produce the same sorts of effects. margin-left can be used to add a specific measurement or percentage value between elements. It shares the same values as its sibling properties margin-top, margin-right and margin-bottom.

margin-left can take one of three different types of values: an auto value that sets things to the default spacing value between elements, a precise unit of measurement value or a percentage value. You can see the effects of a measurement value, a percentage value and a negative value applied to the code seen in Listing 12.28, whose results can be seen in Figure 12-35.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint