Problems with styling HTML page in an iframe (in Chrome and IE)
I'm loading an HTML file into an iframe
, and it has a linked CSS file*. This works as expected in Mozilla, but not in IE and Chrome, where the CSS isn't applied at all. How can I fix this?
*generated using Microsoft Excel
<div id="reportholder" style="width:100%; height:100%;">
<iframe name="framename" style="width:100%;height:100%" id="myframe" src="Areas/askue_akt/App_Data/08022011000000.html"></iframe>
</div>
html in iframe:
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1251">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link id=Main-File rel=Main-File href="../08022011000000.html">
<link rel=File-List href=filelist.xml>
<link rel=Edit-Time-Data href=editdata.mso>开发者_高级运维
<link rel=Stylesheet href=stylesheet.css>
<style>
<!--table...
First off: Excel produces catastrophic HTML. You are lucky that it works at all. Alone the fact that even Microsoft's own IE can't cope with it, should hint at how bad it is. So what you should do first is consider, whether you don't have any other options other than using Excel's HTML. What you can try is validate the HTML and correct the errors, however the amount of errors will be probably overwhelming large.
One thing you should to in order to solve the problem with the style sheet, is to check if the server is using the correct MIME type. This is probabyl easiest in Firefox. Load the URL of the CSS directly in the browser, and check in the menu Tools > Page Information. There under "Type:" it should say text/css
. If not, then somethings probably wrong with your server configuration.
精彩评论