Home > Web Front-end > CSS Tutorial > How to solve IE11 css Hack

How to solve IE11 css Hack

php中世界最好的语言
Release: 2018-03-09 17:17:10
Original
3544 people have browsed it

This time I will bring you how to solve the css Hack of IE11, and what are the precautions to solve the css Hack of IE11. The following is a practical case, let’s take a look.

<script>
// 针对IE10
if(/*@cc_on!@*/false){
document.documentElement.className+=&#39; ie&#39;+document.documentMode;
}
// 针对IE11及非IE浏览器,
// 因为IE11下document.documentMode为11,所以html标签上会加ie11样式类;
// 而非IE浏览器的document.documentMode为undefined,所以html标签上会加ieundefined样式类。
if(/*@cc_on!@*/true){
document.documentElement.className+=&#39; ie&#39;+document.documentMode;
}
<script />
Copy after login
<style>
.ie10.testclass{
color:red
}
.ie11.testclass{
color:blue
}
.ieundefined.testclass{
color:green
}
<style />
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese website Other related articles!

Related reading:

How axios makes HTTP request client based on Promise

How VUE uses anmate.css

Easy to use 404 components

The above is the detailed content of How to solve IE11 css Hack. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template