views:

34

answers:

2

In the case the html is opened in IE I want to use a different style sheet ONLY. However, it seems that it is pulling some elements properties from style.css as well. How can this be? Doesn't the [if gte IE 5] ensure only IEstyle.css is used? What is the best way to fix this?
Thanks.

<head>
    <title>!</title>

 <link rel="stylesheet" href="style.css" type="text/css">
      <script src="rows.js" language="javascript" type="text/javascript"></script>
      <script type="text/javascript" src="jquery.js"></script>



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


    <script type="text/javascript">callonload();</script>



</head>
+1  A: 

styles.css still applies for styles that are not explicitly overridden in your IE stylesheet. The way you put it, styles.css gets always loaded.

To prevent loading styles.css in IE use

<![if !IE]>

source: MSDN

Basics on conditional comments: http://www.quirksmode.org/css/condcom.html

Pekka
I am thinking going forward I will wrap my entire pages in `<![if !IE]>` :)
Doug Neiner
thanks, I did not know that the way I had it always loads style.css, I thought that if it hit [if gte IE 5] it would REPLACE style.css with IEstyle.css
Tommy
@doug: :) :) :)
Pekka
+3  A: 

Not totally getting the thinking behind what you are doing, but you need this:

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

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

Basically, "IF NOT IE" for the other styles, and "IF IE" for the styles you want.

Doug Neiner
thanks.....................
Tommy