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

Chapter 12. Box Properties > margin Property

12.36. margin Property

This is a “shortcut” property that allows the Web author to quickly set margins that can combine the values of the rest of the margin sub-family of properties: margin-top, margin-bottom, margin-left and margin-right. In fact, this property makes things easier if you intend to set margin values for more than one side of a Web element.

This property can take from one to four separate numerical values, which work in exactly the same manner as the padding and border properties. In this case, it sets the width of the selected margin. The default unit is pixels, so if no measurement unit is specified, the value given is assumed to be a pixel value. If a single numerical value is present, all borders are set to that value. If two numerical values are present, the top and bottom and then the side borders take on those values, respectively. If three values are present, the top, right and left and then the bottom take the numerical values specified. Finally, if four values are present, the top, right, bottom, then left border take the numerical values specified. When specifying these values, they must be accompanied by the measurement value to be used and they must all be separated by a space, as can be seen in Listing 12.31 (whose results can be seen in Figure 12-38).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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