Pages

Sunday, November 28, 2010

CSS layout

  • To make the container div at the center of the page:
  1. give it width (otherwise it will be Auto or 100%)
  2. margin-left:auto;
    margin-right:auto;
  • 3 columns layout div:
  1. header div is normal with width (or optional width if you use a wrapper div)
  2. left div has (float:left) (should has width)
  3. main div (float:left) (should has width)
  4. right div (float:right) (should has width)
  5. bottom div has clear both (should have height)
Tip: positioning with float, need the elements be in the right order (2,3 can be swapped)

No comments:

Post a Comment