How do I write CSS rules just for IE

Discussion in 'CSS' started by adnan, Sep 27, 2007.

  1. #1
    Anybody know if there's a way I can write some rules just for IE and nothing else.

    If u look at this page

    http://www.directoryjunction.com/forums/

    On firefox the header is fine.

    On IE it's like 3 or 4 px from the top edge.

    I wanted to write some rules to move that up a few notches in IE.

    Can anybody tell me how that thing looks in IE 7?

    thx
     
    adnan, Sep 27, 2007 IP
  2. tripo

    tripo Peon

    Messages:
    8
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi,

    I don't think you need a rule just for IE. Put this as the first rule of you CSS:
    
    * {
    	margin:0;
    	padding:0;
    }
    
    Code (markup):
    In your code you have:
    
    body
    {
    	background: #00758B;
    	color: #000000;
    	font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
    	margin: 5px 10px 10px 10px;
    	padding: 0px;
    }
    
    Code (markup):
    Change the top margin of the body to 0 by modifying this line:

    margin: 0 10px 10px 10px;

    Anyway, if you want to write some rules for IE only, use conditional comments in your html code
    
    <!--[if IE]>
    Special instructions for IE
    <![endif]-->
    
    Code (markup):
    Hope it helps
     
    tripo, Sep 28, 2007 IP
    adnan likes this.
  3. adnan

    adnan Peon

    Messages:
    1,614
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thx tripo.

    I changed the body css.

    Working great now.

    rep added.

    also does anybody know what's up with this IE.

    On IE 6 I get like a 'Privacy Report' when I visit my site.

    How do i get rid of that?

    thx
     
    adnan, Sep 28, 2007 IP