TL DR
I read a lot of stack overflow questions on this issue, and I tried to follow this advice. However, my CSS stylesheet will not work in Chrome / Safari, but it can work in Internet Explorer.
The only thing I see in my script is my server, which returns all files by type application/octet-stream . I cannot change this aspect of the server. Is there something I can do to interpret my CSS file as a stylesheet in Chrome / Safari and IE?
I have an embedded web server project that I am working on. I have very limited control over the server software and the ability to configure settings at the page level. All I can do is create static HTML, CSS, and image files that are compiled into a server application.
Thus, all files that are returned from the embedded server are declared as application/octet-stream in the HTTP header. This causes warnings in Chrome, but no errors.
Initially, I had a problem loading this stylesheet in Chrome / Safari, but it would work in IE. After reading a couple of questions about stack overflows, I found that I need to change the style declaration from:
<link rel="stylesheet" href="/styles/index.css">
in
<link rel="stylesheet" type="text/css" href="/styles/index.css">
When I made this change, Chrome and Safari were still unable to process the CSS file, but IE also began to ignore the stylesheet.
Oddly enough, if I don't declare a DOCTYPE in my HTML document, I can link stylesheets to work in all my browsers. This, however, is not a desirable solution.
My hunch is that this problem has something to do with the HTTP header declaration and that it does not match the type declared in the link element.
What can I do to make this style sheet work in Chrome, Safari, and IE, while following good web development practice codes (i.e. using dotypes in my HTML files and not embedding the style code in the HTML headers?)
For clarity, the corresponding CSS / HTML code is shown below.
index.css
html {height:100%} body {margin:0;min-height:100%;position:relative} iframe {width:100%;height:100%;border:none} .hdr {min-width:765px;overflow:auto} .logo1 {float:left;margin:4px} .logo2 {float:right;margin:4px} .menu {position:absolute;top:70px;left:0px;bottom:0px;width:175px} .content {position:absolute;top:70px;left:175px;bottom:0px;right:0px;}
index.htm
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <link rel="stylesheet" href="/styles/index.css"> </head> <body lang="en-us"> <div class="hdr"><img class="logo1" src="/images/logo1.png" alt="Logo #1"><img class="logo2" src="/images/logo2.png" alt="Logo #2"></div> <div class="menu"><iframe name="menu" src="/menu.shtm"></iframe></div> <div class="content"><iframe name="main" src="/home.htm"></iframe></div> </body>
FYI, this is a new project that is being developed from an existing one. The original project did not declare DOCTYPE in the HTML files. Therefore, all of the page data was loaded and executed in the browser in quirks mode. In addition, index.htm originally consisted of several frames within the frameset .
I am trying to update this application using the correct and modern methods for developing web pages. I can make this application work, but I feel that it would be a victim of compatibility with a future browser if I have to rely on browser ghost mode and frame sets.
I tried to close the link tag, but that does not help. Technically, this should not be a problem, as this document is declared as an HTML5 document, not XHTML.