How I can write CSS for IE. My code not work in IE10 nor 9,7,8?

Tags: css,internet-explorer-10

Problem :

I have seen that the code I have is broken in IE. I tried it on IE9 and 8 and it works after writing some additional CSS to my pages.

Unfortunately I found that my IE hack is not working for version 10 that was launched recently. I go with but it's not working for now. I am testing it on windows 7 IE10.

For old IE I have written code like this

<!--[if IE]>
    <link rel="stylesheet" href="assets/ie.css">

Do someone have any trick for IE10. I have seen that IE10 work fine if I add this to my stylesheet. Now I want to know how to add Ie.css in IE10 browser.

Remember that IE10 is no longer support IE comments. using Ie.css my code work in all browser except version 10.

Solution :

In CSS, this condition works for me:

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {  
   /* IE10-specific styles go here */  

In JS, the same, it works for me:

<!--[if !IE]><!--<script>  
if (/*@cc_on!@*/false) {  
    document.documentElement.className+=' ie10';  

.ie10 .example {  
   /* IE10-only styles go here */  


    CSS Howto..

    In a html table cell, how can i force images to be the bottom left and the bottom right that have different heights?

    How to get div so it always reaches the bottom?

    How to target Microsoft Edge with CSS? [duplicate]

    How can I change the selection text background using CSS?

    CSS/HTML - How do I get text to go behind an image inside a div

    How do I get rid of the last tr td bottom border using css?

    How to style my HTML form using CSS

    How to use CSS in LWUIT framework?

    How to use javascript to transition a property from a set attribute to a new attribute

    How do you center a picture AND left align text that is touching said picture? HTML5

    How can I transcend my confusion over CSS?

    Is XSS possible via an @import, and if so how? Are there ways to protect against it?

    CSS - How to resize texboxes with background image when browser is resized?

    How to show hidden content when hover in CSS not working

    Percentages in CSS: How are they calculated internally?

    Best practice: how to name css default state? [closed]

    How do I fix hover property of a div?

    how to create 100% vertical line in css

    CSS: How to create a background cutout using elements (not images)?

    How to stop loading pdf on mobile device?

    How to add a half circle at the bottom middle of my header?

    How to force the horizontal scroll bar to appear?

    How to add slide animation when showing elements

    How To Make iPhone6 Plus Landscape Mode Work Better with Bootstrap3?

    CSS Overflow: overlay. Is it deprecated? How can I replace it?

    The input fields do not have the same width. How to resolve this CSS challenge?

    How to create reusable Durandal widgets

    How do I submit suggestions to the CSS spec? [closed]

    How to use imported css styles in GWT correctly

    How to replicate this css media jquery using javascript to support IE