html - 外部 CSS 在 IE11 中不起作用

标签 html css internet-explorer-11

我已经编写了自己的嵌入服务器,它可以生成对网络浏览器的响应。 生成的“主页”就像下面的 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 &copy; 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/ , 并且需要基本身份验证。 知道我该如何解决它吗?

更新

  1. 我读过 the stackoverflow thread之前,我确定我的问题不是关于浏览器缓存。感谢 Mauro 的通知。

  2. 我试过 Chrome + IE tab2,CSS 有效,但不适用于导航和页脚标签。我猜 IE 标签页不支持 HTML5。

更新

  1. 我已经尝试了封闭式和非封闭式链接标记,它们都不能解决我在 IE11 上的问题。

  2. 我已尝试禁用基本身份验证,但仍然无法正常工作。

更新

  1. CSS 也适用于 Firefox 39。

  2. 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/

相关文章:

jquery - 计时器 - 使用 jquery 函数在 2 秒内显示 0 到贬值

html - 如何在现有类上强制执行 css 样式(尤其是在 Bootstrap 中)

html - angular material layout-align space-between 在 IE 中不起作用

javascript - CSS(滚动): why is it not possible to base the command on class name instead of id?

javascript - 打印 div 在 angularjs 中不起作用

jQuery、CSS3 或 HTML5 转换?

css - 每个元素都具有与最宽元素相同的宽度

javascript - 从左边开始将 <span> 分成下一行(rtl 语言)

html - CSS 形式 :valid selector doesn't work in IE11

javascript - html 表单崩溃 IE 11