IE 7 problem with width

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfaisalwarraich
    New Member
    • Oct 2007
    • 194

    IE 7 problem with width

    hi everyone,

    there is some very very basic code dat i tried to see how things working in CSS. but at the very begining this is what im getting here. here is the code:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    
    <style type="text/css">
    
    <!--
    body, div{
    	margin:0;
    	padding:0;
    
    }
    #header {
    	
    }
    #header #left {
    	background-color: #036;
    	height: 100px;
    	width: 50%;
    	float: left;
    	
    }
    #header #right {
    	background-color: #666;
    	width: 50%;
    	float: right;
    	height:100px;
    	
    }
    -->
    </style><body>
    <div id="header">
      <div id="left"></div>
      <div id="right"></div>
    </div>
    
    
    
    </body>
    </html>
    this is working fine in firefox but in IE7 it is bit different i dont know why this is very simple code though. the blue div is up and grey div is down of it. please tell me why it is happening? i will be grateful to you. and tell me the solution.

    thanx again.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You have a missing closing head tag.

    Instead of 50%, try making it 49.99% and you can float it left instead of right.

    Comment

    Working...