External CSS doesn't work in IE11

I wrote my own embeddable server that can generate a response on web browsers. The generated "home page" looks like the following 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>
      

Run codeHide result


And the generated CSS file

.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;
}
      

Run codeHide result


When I view the homepage through Chrome 43 or Firefox 39, they are both ok. However, when I use IE11, the CSS is not applied to the html, although I can make sure IE11 can access the CSS file from my server. If I press F12 in IE, the DOM manager does not display the stylesheet on this page.

By the way, my url is http: // localhost: 8888 / and needs basic authentication. Any idea how I can fix this?

UPDATE

  • I've read this StackOverflow question before and I'm pretty sure my problem isn't browser caching. Thanks to Mauro for the notification.

  • I tried Chrome + IE tab2, CSS works but not applicable to nav and footer tag. I think IE tab does not support HTML5.

UPDATE

  • I tried both closed and unclosed link tag, both of them don't solve my problem with IE11.

  • I am trying to disable basic authentication while still not working.

UPDATE

  • CSS also works in Firefox 39.

  • CSS works with IE11 + compatible mode (but HTML5 tags will be ignored).

+3


source to share


3 answers


After comparing many sites, I find out that this problem can be solved easily by simply removing the html5 declaration <!DOCTYPE html>

. However I don't understand why IE11 acts like this, it must support html5.



PS. I have read this SO article and will add type="text/css"

, but IE11 never seems to care about this.

+1


source


Make sure the HTML1202 issue here might solve your problem.



if so, check the following: How to avoid the ie8 compatibility button?

0


source


Try adding this attribute to your link tag: type = "text / css" Example:

<link rel="stylesheet" type="text/css" href="styles.css" media="screen">

      

0


source







All Articles