Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Member PixelFool's Avatar
    Join Date
    Feb 2004
    Location
    Rochester, NY
    Posts
    30
    Member #
    4871
    Hello all -

    I'm having a LOT of trouble trying to center a container div in Netscape and Mozilla. Of course it works fine in IE if I use
    body {text-align: center; }. However, I've tried more than one thing on Netscape and Mozilla (margin-left: auto, margin-right:auto, aligning the div, putting it IN another aligned container div).. nothing seems to work.
    I know that Netscape has a lot of trouble with divs that contain other divs but no actual content.. and I'm not sure why.
    Is that my problem?
    Is there a hack I'm supposed to use?

    The actual page is located at www.pixellatedfool.com/problems/main2.html
    and the CSS file is located at www.pixellatedfool.com/problems/agony_style2.css

    Any help would be greatly appreciated!
    Iris*
    http://www.pixellatedfool.com

  2.  

  3. #2
    Senior Member Aleister's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    250
    Member #
    2329
    Try getting rid of "align: center" in the container.

    I always use 2 things and it works for me. The text-align center in the body, and the margin-left: auto, and margin-right: auto in the container.

    I always have an outer container when I use a centered layout.. never any netscape problems yet, unless you are talking about netscape 4.. and if thats the case most of your css won't work anyway and you can use an alternate css file for older browsers.
    The Temple of Dagon | Dagon Design
    "That is not dead which can eternal lie, And with strange aeons even death may die." - HPL

  4. #3
    Senior Member Aleister's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    250
    Member #
    2329
    Actually there is another method I use too, which works even better for me. Do not use text-align: in the body. and do not use align: in the container. Just do this in your container:

    position: relative;
    margin-left: auto;
    margin-right: auto;

    And make sure to define a width of course. This is what I use on my main domain (www.templeofdagon.com). It works in IE6, Netscape 7, Opera, Firefox, Mozilla variants, Safari, IE5 Mac, and various linux browsers I have tested in.
    The Temple of Dagon | Dagon Design
    "That is not dead which can eternal lie, And with strange aeons even death may die." - HPL

  5. #4
    Member PixelFool's Avatar
    Join Date
    Feb 2004
    Location
    Rochester, NY
    Posts
    30
    Member #
    4871
    Haha I'm so sure that I did that already! But you're right, it worked just fine, even in IE I believe.
    I actually also fixed the sub-problem I was having with certain divs not showing up in the other browsers (I guess you really need to specify exact widths etc.).

    Thanks a ton Aleister! Nice lizard.

    **EDIT**

    You must've been posting while I was replying ^_^ I'll definitely try that second one as well, might be more solid. Thanks , you rock ^_^
    http://www.pixellatedfool.com

  6. #5
    Senior Member Aleister's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    250
    Member #
    2329
    No problem Glad it worked.

    (Did you see my second method too? I probably posted it the same time as your response so you may of overlooked it
    The Temple of Dagon | Dagon Design
    "That is not dead which can eternal lie, And with strange aeons even death may die." - HPL

  7. #6
    Senior Member Aleister's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    250
    Member #
    2329
    Lol.. yes we both seem to keep posting at the same time!
    The Temple of Dagon | Dagon Design
    "That is not dead which can eternal lie, And with strange aeons even death may die." - HPL


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:11 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com