Do not load a CSS if IE8

2

Problem: I would like to not load the CSS if it is IE8

For all other browsers I want to load CSS

I thought about doing

<!--[if IE 8]> (deixar vazio)

and put for each type of browser the CSS Webkit, Gecko, but I think it is not the solution

Is there something like this? ELSE?

<!--[if IE]>

<![else]>
<link rel="stylesheet" type="text/css" href="cstyle.css" />
<![endif]-->
    
asked by anonymous 06.04.2015 / 17:07

2 answers

3

There is no ELSE in conditional comments as far as I know ... but you can do a NOT :

<![if !(IE 8)]>
... IE 8 vai ignorar este bloco, mas os outros navegadores vão aceitá-lo
... estilo aqui ...
<![endif]>

There are two types of conditional comments in IE:

  • not revealed (other browsers can not see):

    <!--[if IE 8]>
    <p>Somente IE 8 vai var isso.</p>
    <![endif]-->
    
    <!--[if !(IE 8)]>
    <p>IE diferente de 8 vai ver isso. Outros browsers não vão ver.</p>
    <![endif]-->
    
  • revealed (other browsers can see):

    <![if IE 8]>
    <p>Se for IE somente o 8 vai var isso, além dos outros browsers também verem.</p>
    <![endif]>
    
    <![if !(IE 8)]>
    <p>Se for IE e diferente de 8 vai ver isso. Outros browsers também vão ver.</p>
    <![endif]>
    

Documentation on conditional comments (in English)

    
06.04.2015 / 17:12
1

I think the way to do this would be to create a style sheet that cancels the set values and include in if IE. For example:

<style>
 #elemento{
 width: 100px;
 height: 50px;
}
</style>

<!--[if IE 8]>
<style>
 #elemento{
 width: auto;
 height: auto;
}
</style>
<[endif]-->
    
06.04.2015 / 17:09