Forum Moderators: open

Message Too Old, No Replies

Simple Tip

when having strange troubles

         

toolman

11:24 pm on Feb 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you ever find yourself trying to debug a strange bug (usually css related) check your doctype tag. Most of the time I have found there to be disparities in the way a browser renders a page based on the differing doctypes. By simply removing the tag you may find the problem resolved and if you look closely you'll probably see you had 2 different doctype declarations or a space in the tag itself (usually messes up Netscape)

universalis

3:00 pm on Feb 26, 2003 (gmt 0)

10+ Year Member



This is a well-known issue. For more information on this, you can google for "DOCTYPE switching". Bear in mind that modern browsers such as IE6, Mozilla, Opera 7 and others use doctype sniffing to select either a "standards compliant" mode or a "quirks" mode for rendering the page. The standards compliant mode is for sites using W3C-validated markup, identified with a full HTML or XHTML doctype. The quirks mode tries to emulate older browsers in the way they deal with old-fashioned tag soup sites with incomplete of missing doctypes.

Your best bet is to use an appropriate doctype and author to standards compliant mode, checking your HTML and CSS with the validators to ensure correctness.

Try this article for starters:

[alistapart.com...]

Hester

2:31 pm on Feb 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure your DTD (Document Type Definition) is always on the first line. Otherwise IE6 ignores it! I was going nuts wondering why a layout I'd perfected was suddenly a right mess. Eventually I realised I'd saved it from an email attachment which had put a comment line in at the top! Once I removed that, everything was fine again.

I'm using XHTML 1.0 Transitional and I believe if IE6 doesn't see the DTD, it goes into Quirks Mode (HTML 4). It can ruin a perfectly good layout!

andreasfriedrich

3:07 pm on Feb 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>Quirks Mode (HTML 4)

It would be nice if it were as you seem to suggest that quirks mode is a HTML 4.01 compliant mode. It is not. It´s just Microsoft´s own idea of how to interpret and display some code that resembles HTML to a certain extent.

But I´m with you on that you should use a valid DTD and author your code in a standard compliant way. There is no need to use XHTML. If all you need is HTML2 go with that but choose the appropriate DTD.

Andreas

[edited by: andreasfriedrich at 3:09 pm (utc) on Feb. 27, 2003]

creative craig

3:09 pm on Feb 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am having a problem with quirks and Opera at the moment :(

Micro$oft like and Opera say they dont!

Craig