Setting the Margins around an ElementThe margin is the amount of transparent space between one element and the next, in addition to and outside of any padding (see page 177) or border (see page 184) around the element. Figure 11.16. One of the principal margin adjustments is to the wrap div. When you set two values, the first is applied to the top and bottom margins, the second is applied to the left and right margins.We'll set the top and bottom margins to 20px to give our design a little space.
To set an element's margins: Type margin: x, where x is the amount of desired space to be added, expressed as a length, a percentage of the width of the parent element, or auto. Figure 11.17. The auto margin setting centers the layout in the window by dividing up the leftover 10% of the browser window width that is not used by the wrap div between the right and left margins.Tips
|