如何指定 IE 11 特定的 css 文件?
How do I specify IE 11 specific css file?
我目前有一个页面,当用户使用以下 html 语法单击打印按钮时,我正在为其应用一些特定于浏览器的 CSS 样式。但是以下 html 代码不会应用为 IE11(ie11print.css) 指定的 css,而是应用为其余 IE 版本指定的 css(ieprint.css).
<!--[if IE 11]> <link rel="stylesheet" media="print" title="Print" type="text/css" href="/styles/ie11print.css" /><![endif]-->
<!--[if lte IE 10]> <link rel="stylesheet" media="print" title="Print" type="text/css" href="/styles/ieprint.css" /><![endif]-->
<!--[if !IE]>--><link rel="stylesheet" media="print" title="Print" type="text/css" href="/styles/print.css" /><!--<![endif]-->
有人知道如何为 IE11 指定一个 CSS 文件吗?
提前致谢。
使用以下 hack,然后使用您的 css 风格:
*::-ms-backdrop,
示例:
*::-ms-backdrop,/*Your element*/ {
/*Your styles*/
}
注意:它只会影响IE browsers.So您需要在此之前应用您的正常样式。
只需在您的 CSS 样式表中添加以下内容即可在 Internet Explorer 11 中查看
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)
{
Add your styles here
}
检查浏览器是否为ie11
然后直接从 javascript
添加 link 标签
window.location.hash = !!window.MSInputMethodContext;
if (window.location.hash)
{
var $head = $("head");
var $headlinklast = $head.find("link[rel='stylesheet']:last");
var linkElement = "<link rel='stylesheet' href='/styles/ie11print.css' type='text/css' media='screen'>";
if ($headlinklast.length){
$headlinklast.after(linkElement);
}
else {
$head.append(linkElement);
}
}
如有任何疑问,请告诉我。
window.location.hash 将 return 对 ie11
为真
我目前有一个页面,当用户使用以下 html 语法单击打印按钮时,我正在为其应用一些特定于浏览器的 CSS 样式。但是以下 html 代码不会应用为 IE11(ie11print.css) 指定的 css,而是应用为其余 IE 版本指定的 css(ieprint.css).
<!--[if IE 11]> <link rel="stylesheet" media="print" title="Print" type="text/css" href="/styles/ie11print.css" /><![endif]-->
<!--[if lte IE 10]> <link rel="stylesheet" media="print" title="Print" type="text/css" href="/styles/ieprint.css" /><![endif]-->
<!--[if !IE]>--><link rel="stylesheet" media="print" title="Print" type="text/css" href="/styles/print.css" /><!--<![endif]-->
有人知道如何为 IE11 指定一个 CSS 文件吗? 提前致谢。
使用以下 hack,然后使用您的 css 风格:
*::-ms-backdrop,
示例:
*::-ms-backdrop,/*Your element*/ {
/*Your styles*/
}
注意:它只会影响IE browsers.So您需要在此之前应用您的正常样式。
只需在您的 CSS 样式表中添加以下内容即可在 Internet Explorer 11 中查看
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)
{
Add your styles here
}
检查浏览器是否为ie11
然后直接从 javascript
添加 link 标签 window.location.hash = !!window.MSInputMethodContext;
if (window.location.hash)
{
var $head = $("head");
var $headlinklast = $head.find("link[rel='stylesheet']:last");
var linkElement = "<link rel='stylesheet' href='/styles/ie11print.css' type='text/css' media='screen'>";
if ($headlinklast.length){
$headlinklast.after(linkElement);
}
else {
$head.append(linkElement);
}
}
如有任何疑问,请告诉我。 window.location.hash 将 return 对 ie11
为真