CSS and Internet Explorer

  beynac 16:12 04 Apr 2006

I've been messing about with CSS to get a webpage to scroll under the menu (as if it used frames). I could get it to work in Firefox but it needed a bit of tweaking for IE. I had saved a copy of the page, without the php code, and then put in html comments to show where the three php page elements started. I was using a copy of this to try different solutions. Once I had solved the problem, I copied the html code back into the original page. Everything looked the same but it didn't scroll in IE !!!

The only difference was the html comments. I found that the problem was that I had put a comment as the first line on the page:

!-- header.php -->
!DOCTYPE HTML PUBLIC "-//W3C/ ....etc.>

Once I had moved this below the !DOCTYPE .. tag, everything worked. OK - problem solved - but does anyone have any idea why the comment tag should interfere with some elements of the stylesheet and not others?

  beynac 22:16 04 Apr 2006

but a good one! I deleted the DTD and the comment: - no scrolling in IE. It obviously needs the DOCTYPE tag to interpret the stylesheet fully.

Thanks, I will be able to sleep tonight now!

You're also right about web design driving you mad. As an afterthought, I tried Opera and had to make another adjustment!

  PurplePenny 23:34 04 Apr 2006

The DTD determines whether IE operates in Quirks Mode or Standards Mode so it does indeed make a difference to the way that IE interprets both CSS and HTML.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

EE is the UK's first 5G network, launching next week

Philips 499P9H monitor review – this 49-inch screen turns heads and will make your colleagues…

MacBook Pro Buying Guide: 13in vs 15in MacBook Pro

Test : casque audio Avanti C de Moshi