Results 1 to 5 of 5

Thread: Please help me with centering

  1. #1
    Join Date
    May 2007
    Posts
    99
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Unhappy Please help me with centering

    A nice guy on the DD forums gave me this code awhile back. It's so amazing, it helped me absolutely position elements inside a div. It's supposed to center the parent, and then the contents inside are absolutely positioned where I want. But for some reason, although the div centers perfectly in IE, it doesn't center in Firefox. Can you please help me?

    This is in the HEAD section:
    Code:
    <style type="text/css">
    .container1 {
    position:relative;
    width:275px;
    height:658px;
    margin:0 auto;
    }
    .abs_im {
    position:absolute;
    border:none;
    }
    #pic1 {
    top:0;
    left:0px;}
    #pic2 {
    top:534;
    left:210;
    }
    </style>

    This is in the BODY section:
    Code:
    <div class="container1">
    <img class="abs_im" id="pic1" alt="" src="images/notepaper_1.png" width="384"  height="658">
    <a href="javascript:poptastic('get.html');"><img class="abs_im" id="pic2" alt="" src="images/clickme.gif" width="100" height="98"></a></div>

  2. #2
    Join Date
    Sep 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Centers for me, based on what you provided, do you have this div inside another div or some such? Could be a float issue?

  3. #3
    Join Date
    May 2007
    Posts
    99
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    It wasn't centering. But wait, I figured it out. In the head section, I had the width of the div set smaller than the width of the biggest image inside it. I overlooked it because I had changed images to a wider one. I fixed it and it centers perfectly now in FF. Thanks for reading. Maybe someone else can benefit from the code.

  4. #4
    Join Date
    Jun 2009
    Location
    Laputa
    Posts
    43
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    State that this is resolved, please.

  5. #5
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    try adding margin-left: auto; margin-right: auto;

    that is usually what firefox expects

Bookmarks

Posting Permissions

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