Microsoft announced that now IE supports everything, but in fact - with flexes, trouble, with the bootstrap - trouble (indenting differently).
How can these problems be solved now if conditional comments were canceled in versions of IE10 +?
Microsoft announced that now IE supports everything, but in fact - with flexes, trouble, with the bootstrap - trouble (indenting differently).
How can these problems be solved now if conditional comments were canceled in versions of IE10 +?
here is an option using javascript
javascript
var doc = document.documentElement; doc.setAttribute('data-useragent', navigator.userAgent); css
html[data-useragent*='MSIE 10.0'] h1 { color: blue; } There is also such a css hack:
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { /* IE10 IE11 */ } If you need to use it in combination with other media queries, for example, for organizing adaptive layout, you can combine queries. For example:
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) and (max-width : 768px){ /* IE10 IE11 Π΄ΠΎ 768px ΠΏΠΎ ΡΠΈΡΠΈΠ½Π΅*/ } By .selector meant the selector you need.
/* Internet Explorer 11+ */ _:-ms-fullscreen, :root .selector { /* ΠΡΠΆΠ½ΡΠ΅ ΡΡΠΈΠ»ΠΈ */ } /* Internet Explorer 10+ */ _:-ms-lang(x), .selector { /* ΠΡΠΆΠ½ΡΠ΅ ΡΡΠΈΠ»ΠΈ */ } /* Internet Explorer 9+ */ _::selection, .selector { /* ΠΡΠΆΠ½ΡΠ΅ ΡΡΠΈΠ»ΠΈ */ } /* Π’Π°ΠΊΠΆΠ΅ ΠΌΠΎΠΆΠ½ΠΎ ΡΠ°ΠΊ Π΄Π»Ρ IE10+ */ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { /* ΠΡΠΆΠ½ΡΠ΅ ΡΡΠΈΠ»ΠΈ */ } Create a separate file, for example, ie.css .
Next, connect it depending on the browser.
link element and point it to the href in our ie.css file.Code example
var isIE = false || !!document.documentMode; if (isIE) { var head = document.getElementsByTagName("head")[0]; var link = document.createElement("link"); link.rel = "stylesheet"; link.href = "ie.css"; head.appendChild(link); } /* ΡΡΠΈΠ»ΠΈ ΡΠΎΠ»ΡΠΊΠΎ Π΄Π»Ρ IE9 */ @media screen and (min-width:0\0) { button:active, button:focus { top: -1px; left: -1px; } } /* ΡΡΠΈΠ»ΠΈ ΡΠΎΠ»ΡΠΊΠΎ Π΄Π»Ρ IE10 ΠΈ IE11 */ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { button:active, button:focus { top: -1px; left: -1px; } } Source: https://ru.stackoverflow.com/questions/609137/
All Articles