css ie6 fix

Discussion in 'Web Design' started by why not, Sep 25, 2008.

to remove all ads.
  1. why not

    why not New Member

    Messages:
    2
    hi ! this code worked with firefox ! opera ! but not work in ie6 -
    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=iso-8859-1" />
    <title>Test</title>
    </head>
    <body >
    <div align="center">
    <div style="width:100%; height:10px; background-color:#000000;"></div>
    </div>
    </body>
    </html>
    NOTE Error in IE6 : height Div over 10px ! and space div with top is long
    SORRY For Bad English Grammer
     
  2. jnjc

    jnjc New Member

    Messages:
    493
    IE applies a default margin and padding to things, FF doesn't.

    Try this:

    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=iso-8859-1" />
    <title>Test</title>
    </head>
    <body style="[B]padding:0;margin:0[/B]" >
    <div align="center">
    <div style="width:100%; height:10px; background-color:#000000"></div>
    </div>
    </body>
    </html>

    If you are using a style sheet just add this to the top of the sheet:

    Code:
    * {margin:0; padding:0;}
    HTH,
    JC
     
  3. sheanhoxie

    sheanhoxie New Member

    Messages:
    56
    JNJC is right except that using the * is a hack and you should really be using a separate stylesheet for IE

    You can do so by using:

    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="ie_stylesheet.css">
    <![endif]-->

    Post this right after you post your normal stylesheet.

    Sorry, this is like the 2nd or 3rd time Ive posted this, I dont mean to sound like a broken record....:)
     
  4. jnjc

    jnjc New Member

    Messages:
    493
    For this particular issue you could just put it into the .body and not have a separate .css for IE....
     
  5. why not

    why not New Member

    Messages:
    2
    hi . thanks ! i know with {margin:0; padding:0;} fix space !
    How to fix height div ! example : height:10px; but show div height over 10px ! or div height in ie6 not even div height in FF or opera . how to fix this ?
    thanks
    File attach : 1- ie 2-ff
     

    Attached Files:

    • ie.JPG
      ie.JPG
      File size:
      5.6 KB
      Views:
      959
    • ff.JPG
      ff.JPG
      File size:
      5.8 KB
      Views:
      962
    Last edited: Sep 26, 2008

Share This Page