Do not load a CSS if it is IE8

Asked

Viewed 207 times

2

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

For all other browser I want to load the CSS

I thought I’d make

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

and place CSS for each type of browser Webkit, Gecko, but I don’t think it’s the solution

Is there anything like? ELSE?

<!--[if IE]>

<![else]>
<link rel="stylesheet" type="text/css" href="cstyle.css" />
<![endif]-->

2 answers

3


There is no ELSE on conditional comments as far as I know... but it is possible to make 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:

  • undisclosed (other browsers can’t 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)

1

I think the way to do this would be to create a stylesheet that cancels the defined values and include it in if IE. For example:

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

<!--[if IE 8]>
<style>
 #elemento{
 width: auto;
 height: auto;
}
</style>
<[endif]-->
  • does not give.. CSS is extremely complex and large..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.