SitePoint Sponsor

User Tag List

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

    height and min-height in IE

    try to run this piece of html in IE and compare it to firefox...
    I don't understand why IE ignores height:1px on #second div?

    Code:
    <html> 
    <head> 
    <style type="text/css"> 
    #body{width:100%} 
    
    #first{ 
    height:100px; 
    border-style:solid;border-width:1px;border-color:#000;background-color:#f00; 
    } 
    
    #second{ 
    height:1px; /* <-------why IE ignores this??? */ 
    background-color:#fff; 
    } 
    
    </style> 
    </head> 
    <body> 
    <div id="first"><div id="second"></div></div>    
    <body> 
    </html>
    thank you

  2. #2
    SitePoint Addict
    Join Date
    May 2003
    Location
    Auckland
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably because that second div tag is empty. Put a non-breaking space inside there and add a line-height of 1px or 0 to your css for that div.
    Code:
      <html> 
      <head> 
      <style type="text/css"> 
      #body{width:100%} 
      
      #first{ 
      height:100px; 
      border-style:solid;border-width:1px;border-color:#000;background-color:#f00;
      } 
      
      #second{ 
      height:1px; /* <-------why IE ignores this??? */ 
      line-height: 0;
      background-color:#fff; 
      } 
      
      </style> 
      </head> 
      <body> 
      <div id="first"><div id="second">&nbsp;</div></div>	
      <body> 
      </html>

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    country
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes that helps
    setting overflow:hidden also helps
    i wanted to know why this happens? is it some knownn IE bug?


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
  •