Force CSS in IE

Asked

Viewed 547 times

2

I have a widget on my page and it is reading an external CSS, I would like you to load my CSS as main in Internet Explorer 11. All other browsers load normally, but I need IE to work.

I used "! Important" in css and still did not succeed.

  • My solution worked?

  • Unfortunately it did not work, is not "forcing" my css.

  • I also tested unsuccessfully. I will research some other way.

2 answers

4


Unfortunately, it seems that old CSS implementations in Internet Explorer do not allow using the !important conventionally.

If you simply overwrite or update an attribute won’t work out. This will only work if you’re using Media Queries, such as making a responsive website.

In reality the "correct" would you not need to overlap using the !important, but yes, use a class hierarchy.

For example:

.class1 {
color: #555 !important;
}

.class1 {
color: #FFF;
}

.class1 {
color: #000;
}

The color that Internet Explorer will interpret will be the #000, because it is the one that comes after and so it overlaps the previous ones.

  • But the other browsers will not interpret either, only the color #000?

  • No, the others will interpret #555 by using the ! Mportant.

  • Got it, so Important just doesn’t work on IE?

  • In older versions I would say. I would ignore these versions when developing.

  • Great answer ;) +1

1

You can have two style sheets and use one for IE and others for other browsers.

<!--[if IE]> <link href="somente_ie.css" rel="stylesheet" type="text/css"> <![endif]-->
<!--[if !IE]> <link href="geral.css" rel="stylesheet" type="text/css"> <![endif]-->
  • That’s been trying and it doesn’t work, buddy :/

  • What doesn’t work @Tiagop. C?

Browser other questions tagged

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