Skip navigation
Currently Being Moderated

Help centering divs

May 12, 2011 6:15 AM

Okay I'm tearing my hair out here!

 

I'm working on a Web design for a class.  I'm trying to make a fixed header that is centered on the screen.  The block containing the header is 950 pixels wide and should auto-center.

 

Here's a link:

http://pjutter.com/Sessions/AdvancedCSS/Lesson3/indexNew.html

 

This is working on Firefox and Google Chrome but not on Internet Explorer (where it is totally messed up and unreadable).

 

I cannot figure out how centering works.  Supposedly margin: 0 auto should center a div, but that only occasionally works.  I've used negative margins to center the 950-pixel div, and that works on everything except IE which is ALL messed up.

 

The CSS file for the header is the one called headernav.  The others are part of the Blueprint framework which I'll be using on the grid underneath the header.  So just ignore the others.

 

Can anyone help me with this?

 

Thanks, Phyllis

 
Replies
  • Currently Being Moderated
    May 12, 2011 9:00 AM   in reply to phyllisj9

    I cannot see your css, but did you try adding "display: inline-block;" to the outer <div>?

     
    |
    Mark as:
  • Currently Being Moderated
    May 13, 2011 6:10 AM   in reply to phyllisj9

    I got a 404 error when I clicked your link.

     
    |
    Mark as:
  • Currently Being Moderated
    May 13, 2011 3:31 PM   in reply to phyllisj9

    Can't see your page.  But static (unspecified) positioning is all that's required for 98% of page layouts.  I very rarely use APDivs except for special situations like disjointed rollovers, lightbox windows or flyout menus.  And then I wrap them inside a position:relative container.

     

     

     

    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points