Answer the question
In order to leave comments, you need to log in
Hack for internet explorer 11?
Greetings.
Tell me how to register styles only for internet explorer 11 version.
Answer the question
In order to leave comments, you need to log in
found a solution without js
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* IE10+ specific styles go here */
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
My God. What for? Why did you separate Q&A from habr? People got lazy to the edge. Difficult to google. Right there, now there will be a hell of a mess of shit, and not Q&A.
<!--[if IE 11]>
<link rel="stylesheet" href="/css/ie11.css">
<![endif]-->
Yes, in principle, nothing is bad.
You can modify the above script like this:
$().ready(function() {
var ie10Styles = [
'msTouchAction','msWrapFlow','msWrapMargin','msWrapThrough','msOverflowStyle','msScrollChaining',
'msScrollLimit',' msScrollLimitXMin','msScrollLimitYMin','msScrollLimitXMax','msScrollLimitYMax',
'msScrollRails','msScrollSnapPointsX','msScrollSnapPointsY','msScrollSnapType','msScrollSnapX', 'msScrollSnapY',
'msScroll'FlexTranslation','msScrollFlexTranslation','msScrollFlexTranslation','msScrollFlexTranslation' ,'msFlexOrder'
];
var ie11Styles = [
'msTextCombineHorizontal'
];
/*
* Test all IE only CSS properties
*/
var d = document;
varb = d.body;
var s = b.style;
var ieVersion = null;
var property;
// Test IE10 properties
for (var i = 0; i < ie10Styles.length; i++) {
property = ie10Styles[i];
if (s[property] != undefined) {
$('body').addClass("ie-10");
}
}
// Test IE11 properties
for (var i = 0; i < ie11Styles.length; i++) {
property = ie11Styles[i];
if (s[property] != undefined) {
if ($('body').hasClass("ie-10")) {
$('body').removeClass("ie-10").addClass("ie -eleven");
}
else {
$('body').addClass("ie-11");
});
And conditional compilation is not suitable?
That is, if you write in js:
/*@cc_on
.... // тут код, который видят и исполняют только IE, остальные браузеры считают за комментарии
@*/
And why is the option with js bad if there are no others on the horizon?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question