user978122
user978122

Reputation: 5761

Internet Explorer-> <DIV> & width

I have a page which appears just fine in FireFox / Chrome / Opera / Safari, but appears incorrectly in Internet Explorer. A quick search reveals many issues with DIVs in IE, but none of the items appeared to address this issue.

The issue is that DIV appear to expand to the entire width of the browser, in Internet Explorer; this behavior is not replicated in any of the others.

Code is here: http://pastebin.com/c46uB7GP

CSS is here: http://pastebin.com/TXWWM2Qu

IE rendered image is here: https://i.sstatic.net/DZRBk.jpg

Chrome rendered image is here: https://i.sstatic.net/7p6s7.jpg

Any help would be welcome in resolving this discrepancy.

Thanks, R

Upvotes: 0

Views: 207

Answers (1)

Tapefreak
Tapefreak

Reputation: 982

You have no layout width/height specification in your current code.

Put the content inside an enclosing div that has a width specified in pixels.

It's also better practice to identify your divs with classes (or IDs, if there is only one of them) and define the actual CSS in the CSS file and not in the HTML. This way you can separate presentation from markup, so that you could send the same HTML to, say, a mobile device, but with a different CSS file for that device.

Upvotes: 1

Related Questions