SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: firefox bug ?

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    country
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    firefox bug ?

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <style type="text/css">
    body{background-color:#f0f;}
    #d1{background-color:#f00;width:500px;height:400px;}
    #d2{background-color:#0f0;margin-left:100px;height:400px;}
    #d3{background-color:#000;margin-right:100px;margin-top:20px;height:300px;}
    </style>	
    </head>
    <body>
    <div id="d1">
    	<div id="d2">
    		<div id="d3">
    		</div>
    	</div>
    <div>		
    </body>
    </html>
    firefox 1.0.6
    ie 6

    save above code as html page and run...
    on ie black div is has 20px top margin
    on firefox there is no margin?? 8O

    looks like a bug to me... but maybe it is something i don't know about 8O ?

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    country
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    someone on another forum told me that firefox does it right and ie wrong:
    In Firefox, the margin-top is being set relative to the outer container - d1.

    In IE, its being set relative to the parent (closest) container - d2.
    but this looks very odd to me...
    when i set margin on d3 i want to move it away from its parent edge...so i don't get why the margin on d3 is actually being applied to the top-most container d1...?

  3. #3
    SitePoint Enthusiast sbob's Avatar
    Join Date
    Jun 2005
    Location
    MN, USA
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For one thing, d1 isn't closed. Your missing the slash in it's closing tag. However, that doesn't seem to be causing the problem.
    I'm sure the person from the other forum was right in that firefox is doing it the correct way, but I find it very strange that that's the way it's supposed to be.

    Maybe instead of having a margin-top on d3, you could have a padding-top: 20px; on d2?


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
  •