Results 1 to 4 of 4

Thread: center float.

  1. #1
    Join Date
    Oct 2008
    Posts
    162
    Tokens
    0

    Default center float.

    Ok i'm coding a layout in expandable divs with html and css, i currently have a banner type div which is set to a 0px margin and 100% width and a main content box which also has a 0px margin, and a 550px width. I want the content box to be in the center of the page with the top touching the bottom of the banner (0px margin). So far it looks like this.


    Now, i want the main content box centered, I could do this using the margin-left or margin-right but it would only look right in my monitor/browser; it would be out of place for everyone else.

    How could i resolve this? I looked up float:center but thats not valid css.

  2. #2
    Join Date
    Dec 2007
    Posts
    132
    Tokens
    0

    Default

    try using

    Code:
    margin-left: auto;
    margin-right: auto;
    Waz ;]


  3. #3
    Join Date
    Oct 2008
    Posts
    162
    Tokens
    0

    Default

    works great thanks
    +rep

  4. #4
    Join Date
    Jan 2008
    Posts
    3,711
    Tokens
    100

    Latest Awards:

    Default

    Or you can do it much simplier:
    margin: auto;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •