Ask Experts Questions for FREE Help !
Ask
    suzy_Q's Avatar
    suzy_Q Posts: 1, Reputation: 1
    New Member
     
    #1

    Oct 20, 2007, 07:21 PM
    CSS Overlapping Divs Until Refresh
    Hi,
    Thanks for your help.

    I have a site that I'm working on that once I make any changes and upload the updated page, if viewed in Firefox, the middle div overlaps the left.

    Please see the below snapshots:
    This is what it should look like:


    This is what happens after I make any updates or changes to the page and upload it to the server.


    It looks fine if I do a refresh, but I sure hope that there is something that can be done to make this not occur.

    I really appreciate all the help you can offer. I will send the stylesheet if someone can help me.

    Thanks!!

    Suzy
    Artem's Avatar
    Artem Posts: 61, Reputation: 5
    Junior Member
     
    #2

    Jan 12, 2009, 11:50 AM

    I can't see the screenshots, and I doubt you'll come back to see what I answer to this. Anyway, maybe for some hitchhikers browsing the internet looking for this, then.

    The problem I think you have is float. Although I have no clue what the refresh part makes for a difference.

    So basically, if you float an item, you need to float all following items (preferrably also the previous items) as well.

    Also, don't start worrying about how something looks like in the middle of the design process, by adding all elements, it sometimes occurs that error (which actually aren't errors) fix themselves when you finish coding all elements.

    Hope this helps.
    crigby's Avatar
    crigby Posts: 4,343, Reputation: 107
    Outdoor Power Equipment Expert
     
    #3

    Jan 26, 2009, 06:39 PM

    Ki,
    I cannot see them either. I would say that I think the previous answer probably has some truth to it. Be carefulith "floats" and strict widths.
    Be kmowledgeable of CSS "clear: both;
    Peace,
    Clarke
    dercaw's Avatar
    dercaw Posts: 1, Reputation: 1
    New Member
     
    #4

    Feb 21, 2009, 05:27 PM
    I know exactly what you're referring to - I've had this happen a lot, and it's terribly confusing.

    The problem is that at least one of the overlapping divs is an image, and you didn't declare in the CSS the width and height of that image.

    As a result, the browser can't properly know the dimensions of it until it loads the image, and the first time it creates the page layout it doesn't have that info, so it makes the layout with the image overlapping. This only happens in Firefox and its derivatives for some reason (it jumps the gun on making the layout before all the images load, I guess). Subsequent refreshes it already has the image and its dimensions, and makes the layout just fine.

    The solution is extremely easy: declare the width and height of your image explicitly in the Div's CSS. For example:
    Code:
    #logo {
      float: left;
      padding-left: 12px;
      padding-right: 12px;
      width: 120px;
      height: 50px;
    }
    Then in the HTML:
    Code:
    <a id="logo" href="http://www.myhomepage.com"><img src="./images/logo.png" alt="My Company, Inc."/></a>

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Automatic Refresh on Website [ 6 Answers ]

Hello, How can I set up a web site to automatically refresh daily on the viewers browser... the home page is upadated constantly and I want to make sure visitors are seeing the most current version of the home page. How can I set that if it has been more than 24 hours, the page will...

Refresh what url current visitor is seeing [ 1 Answers ]

I need to create a visitor list that will record and refresh what url or content the current visitor is seeing in an Iframe be it either video or website. Thanks in advance, Edub9 Untitled Document

Greenboard overlapping surround [ 3 Answers ]

I have installed a new tub surround and am ready to install drywall (greenboard). The surround has a lip that is to be covered by the drywall. My question is... are there any special tricks or tips to making the joint smooth and especially water tight? I read a help forum that said to caulk with...

Keep having to 'REFRESH' whilst browsing. [ 10 Answers ]

:) Hi everyone. This is my first ever posting so I hope I'm doing it right. I have had my internet connection for a little over two weeks now and seem to have spent 95% of my time online sorting out 'security' stuff. I have a few final things to tweak and would greatly appreciate anyone's help...

Automatic Page Refresh after done [ 1 Answers ]

Hi, Is it possible to refresh a page automatically after the page has loaded and is done? The page is written in asp. Thanks, John


View more questions Search