homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

HTML Doctype ruined my page

 4:20 am on Nov 26, 2005 (gmt 0)


I had the following doctype on my page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

And all was good until someone pointed out that it was incomplete as it was missing the url. So i added this doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

But now my site is all messed up. Titles and words have moved to different locations, forms have different border thickness and things just look different.

Why is this? I just deleted the url so my page has gone back to normal. Is it such a big deal if i dfont have a doctype? My site looks fine in all major browsers as is and i cant use the wc3 validator anyway because all my pages are php and covered with scripts.

Any info would be great.




 4:34 am on Nov 26, 2005 (gmt 0)

Since you are using an incomplete doctype then you were coding to an unknown set of 'rules'. Now that you've informed the browsers the proper set of rules, they are conforming to that set. So your code was wrong in the first place. I'm surprised you said it works in all the major browsers but I haven't seen your code.

It doesn't matter if you use script for your page, it will still validate if you do it correctly. If it's not validating then you are doing something wrong.


 5:41 am on Nov 26, 2005 (gmt 0)


While my code doesn't validate, it still works fine in ie and firefox so i dont think i'll bother till i rewrite the site at a later date.



 11:01 am on Nov 26, 2005 (gmt 0)

Not sure about FF and Opera, but omitting the url from the doctype has the explicit effect of enabling quirks mode in IE. In this mode, the box-model used is different - width and height includes the padding (and margin possibly).

Try the forum83 - CSS.



 1:55 pm on Nov 26, 2005 (gmt 0)

Yep, it's quirks mode coming into play. Invented in IE5 on the Mac, nearly all major browsers now employ this. The idea is that if you use a full doctype then you know what you're doing and are telling the browser to render according to the rules laid down by the specs. If you don't use a doctype or use a partial one then you're telling the browser that you don't care particularly about the exact rules. In quirks mode browsers try to emulate the idiosyncrasies of previous browsers - for example IE6 in quirksmode will use IE5's broken box model, and Mozilla will emulate Netscape4's inability to inherit text size in ems into tables.

The problem with this is in quirksmode not all browsers have the same quirks - that's the point of standards mode.


 3:55 pm on Nov 26, 2005 (gmt 0)

Here's a thread with a lot more detail about Quirks Mode and Standards Mode [webmasterworld.com]


 6:22 pm on Nov 26, 2005 (gmt 0)

It is not a huge deal using a "half doctype" when you are dealing with an established site designed to work in quirks mode - it will enable you to validate your pages (just because they are dynamic doesn't mean that you can't correct errors in the generated markup) whilst ensuring that modern browsers take into account the fact that the page is not fully compliant woth the latest specifications.

You should always use a full doctype (with the URL) if you are building pages with CSS positioning instead of tables as the standards-compliant parsing mode makes it much easier to ensure cross-browser consistency.


 5:34 am on Dec 4, 2005 (gmt 0)

Thanks all,

Its been a while but have now decided to bite the bullet and use the full doctype and fix up the errors.

I have a couple of questions about it. First, is this doctype here the proper current one to use?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

Also, I am developing my site on my home computer that is sometimes not connected to the internet. If i'm not connected to the net, how can the browser contact that dtd at the specified url? Does is switch back to quirks mode when offline?

Also, is there a place that lists what code u can and cant use in html 4.1 using the above dtd?

Thanks :)


 11:33 am on Dec 4, 2005 (gmt 0)

The contents of the url is typically ignored by browsers but may be used by validators. Rendering will be identical whether you are online or not.



 2:14 pm on Dec 4, 2005 (gmt 0)

I would suggest that you try to go for HTML 4.01 Strict with the following doctype:


As for reference on what can and can't be used, the original W3C docs are a good place to start for both HTML [w3.org] and CSS [w3.org].

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved