Center <div> in CSS?

Discussion in 'Web Design and Development' started by r.j.s, Feb 6, 2009.

  1. r.j.s Moderator emeritus

    r.j.s

    Joined:
    Mar 7, 2007
    Location:
    Texas
    #1
    I'm not great with CSS, so I need a little help.

    On the site, http://www.hood.army.mil/15sus, I have the layout the way I want it. Problem is that it looks really small on higher resolution screens, like my boss's 24 inch ...

    I have edited the CSS to accommodate a larger width, and centered the banner and footer, but I cannot get the menu and slideshow main divs to center. I tried putting them in a container div, like the whole page is, and set the margins to auto, but no dice. Any ideas?

    Attached is the current stylesheet.
     

    Attached Files:

  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Looks centered. What browsers have you tried? Are there certain pages where it's happening?
     
  3. r.j.s thread starter Moderator emeritus

    r.j.s

    Joined:
    Mar 7, 2007
    Location:
    Texas
    #3
    Yes, that one is centered. Take a look at index2.htm. It's a mess.

    Why wont the menu and main content section center?
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    You should really have linked to the problematic page. Might want to go back and fix that so people don't get confused like me.

    I was using Firebug on it and it looks like you have the content and banner set to widths of 1200px rather 800px, which is how wide the banner image is. When I started changing those, things started to fall into place.
     
  5. veyron85 macrumors newbie

    Joined:
    Dec 30, 2008
  6. r.j.s thread starter Moderator emeritus

    r.j.s

    Joined:
    Mar 7, 2007
    Location:
    Texas
    #6
    When I made the original post, I wasn't yet at work and couldn't access the server.

    I need the width to be 1200, if you look now, I got the photos to center, but they are below the menu. I need the menu and the photos side by side.
     
  7. r.j.s thread starter Moderator emeritus

    r.j.s

    Joined:
    Mar 7, 2007
    Location:
    Texas
    #7
    Got it.

    If you check the page code later, you'll see what I was trying to accomplish.

    Now, time for some javascript ...
     

Share This Page