div style working in Firefox but not IE8
I am creating a banner that resizes to fit the window (I got the code of a blog post) and it wor开发者_如何学JAVAks fine in Firefox, but it doesn't display at all in IE8. Please help!!
<html>
<body>
<div style=”position:relative; width:100%; height:100%; margin:0px; padding:0px; left:0px;right:0px;z-index:1”><img src="https://na6.salesforce.com/servlet/servlet.ImageServer?id=01580000000pT8r&oid=00D80000000aYeL&lastMod=1273785188000" width=”100%”></div>
<div style=”z-index:2; position:relative; margin:0px; padding:0px;”>
</div>
</body>
</html>
You've not closed the img tag. It should be as follows:
<img src="https://na6.salesforce.com/servlet/servlet.ImageServer?id=01580000000pT8r&oid=00D80000000aYeL&lastMod=1273785188000" width=”100%” />
I'm guessing this is what's causing the problem. Maybe Firefox is a bit more clever than IE8 at recovering from bad markup.
EDIT:
Baloo's answer baffled me at first because I couldn't see what changes he'd suggested, but it appears another user had edited the question and removed those alternative char set speech characters.
Replace the utf-8 ” with latin1 "
<html>
<body>
<div style="position:relative; width:100%; height:100%; margin:0px; padding:0px; left:0px;right:0px;z-index:1"><img src="https://na6.salesforce.com/servlet/servlet.ImageServer?id=01580000000pT8r&oid=00D80000000aYeL&lastMod=1273785188000" width="100%"></div>
<div style="z-index:2; position:relative; margin:0px; padding:0px;">
</div>
</body>
</html>
Or rather, make sure you save it in the corrent encoding, IE8 plays nice over here
精彩评论