如何通过CSS识别Microsoft Edge浏览器?
How to Identify Microsoft Edge browser via CSS?
我正在开发 Web 应用程序,我需要将 Microsoft Edge 浏览器与其他浏览器区分开来,以应用独特的样式。有没有办法通过使用 CSS 来识别 Edge?
就像,
<!--[if IE 11]>
Special instructions for IE 11 here
<![endif]-->
/* Microsoft Edge 浏览器 12-18(Chromium 之前的所有版本)*/
这个应该有效:
@supports (-ms-ime-align:auto) {
.selector {
property: value;
}
}
更多请看:Browser Strangeness
/* Microsoft Edge Browser 12-18 (All versions before Chromium) - one-liner method */
_:-ms-lang(x), _:-webkit-full-screen, .selector { property:value; }
太棒了!
// for instance:
_:-ms-lang(x), _:-webkit-full-screen, .headerClass
{
border: 1px solid brown;
}
https://jeffclayton.wordpress.com/2015/04/07/css-hacks-for-windows-10-and-spartan-browser-preview/
更准确的 Edge(不包括最新的 IE 15)是:
@supports (display:-ms-grid) { ... }
@supports (-ms-ime-align:auto) { ... }
适用于所有 Edge 版本(目前最高为 IE15)。
For Internet Explorer
@media all and (-ms-high-contrast: none) {
.banner-wrapper{
background: rgba(0, 0, 0, 0.16)
}
}
For Edge
@supports (-ms-ime-align:auto) {
.banner-wrapper{
background: rgba(0, 0, 0, 0.16);
}
}
我正在开发 Web 应用程序,我需要将 Microsoft Edge 浏览器与其他浏览器区分开来,以应用独特的样式。有没有办法通过使用 CSS 来识别 Edge? 就像,
<!--[if IE 11]>
Special instructions for IE 11 here
<![endif]-->
/* Microsoft Edge 浏览器 12-18(Chromium 之前的所有版本)*/
这个应该有效:
@supports (-ms-ime-align:auto) {
.selector {
property: value;
}
}
更多请看:Browser Strangeness
/* Microsoft Edge Browser 12-18 (All versions before Chromium) - one-liner method */
_:-ms-lang(x), _:-webkit-full-screen, .selector { property:value; }
太棒了!
// for instance:
_:-ms-lang(x), _:-webkit-full-screen, .headerClass
{
border: 1px solid brown;
}
https://jeffclayton.wordpress.com/2015/04/07/css-hacks-for-windows-10-and-spartan-browser-preview/
更准确的 Edge(不包括最新的 IE 15)是:
@supports (display:-ms-grid) { ... }
@supports (-ms-ime-align:auto) { ... }
适用于所有 Edge 版本(目前最高为 IE15)。
For Internet Explorer
@media all and (-ms-high-contrast: none) {
.banner-wrapper{
background: rgba(0, 0, 0, 0.16)
}
}
For Edge
@supports (-ms-ime-align:auto) {
.banner-wrapper{
background: rgba(0, 0, 0, 0.16);
}
}