我已经编写了自己的嵌入服务器,它可以生成对网络浏览器的响应。 生成的“主页”就像下面的 html。
<!DOCTYPE html>
<html><head><link rel="stylesheet" href="styles.css"><title>ABC Inc. Web Configurator</title></head><body>
<nav><p>[<b>Home</b>]</p></nav>
<table>
<tr><td><a href=Config>Config</a></td></tr>
<tr><td><a href=Logger>Logger</a></td></tr>
</table>
<footer>Web Configurator © ABC Inc. 2014 - 2015</footer></body></html>
生成的CSS文件是
.even{
background-color: #EFF;
}
.odd{
background-color: #FFE;
}
.title{
background-color: #226;
color: #EEF;
}
a{
color: #36C;
text-decoration: none;
}
a:hover{
text-decoration: underline;
}
body{
font-family: Tahoma;
font-size: 100%;
}
footer{
color: #999;
font-size: 0.7rem;
}
nav{
background-color: #DDF;
font-size: 1.1rem;
}
td{
min-width: 60px;
}
当我用 Chrome 43 或 Firefox 39 浏览主页时,它们都可以。 但是,当我使用 IE11 时,CSS 不适用于 html,即使我可以确保 IE11 可以从我的服务器访问 CSS 文件。如果我在 IE 中按 F12,DOM 管理器不会在此页面中显示任何样式表。
顺便说一句,我的网址是http://localhost:8888/ , 并且需要基本身份验证。 知道我该如何解决它吗?
更新
我读过 the stackoverflow thread之前,我确定我的问题不是关于浏览器缓存。感谢 Mauro 的通知。
我试过 Chrome + IE tab2,CSS 有效,但不适用于导航和页脚标签。我猜 IE 标签页不支持 HTML5。
更新
我已经尝试了封闭式和非封闭式链接标记,它们都不能解决我在 IE11 上的问题。
我已尝试禁用基本身份验证,但仍然无法正常工作。
更新
CSS 也适用于 Firefox 39。
CSS 适用于 IE11 + 兼容模式(但 HTML5 标签将被忽略)。
最佳答案
尝试将此属性添加到链接标签: 类型=“文本/CSS” 示例:
<link rel="stylesheet" type="text/css" href="styles.css" media="screen">
关于html - 外部 CSS 在 IE11 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31647882/