By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,739 Members | 1,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,739 IT Pros & Developers. It's quick & easy.

Which Doctype Should Be Used?

chunk1978
100+
P: 224
hi there... i've got a page that includes CSS, JavaScript and HTML codes... i'd like to know which Doctype i should use at the start...

currently there is no Doctype included at all, and it seems to work fine on Windows IE7 and Mac Safari 2, but shouldn't i include a Doctype? perhaps i'll run into some problems later if i don't include one? and which Doctype should i include?

thanks
Apr 29 '07 #1
Share this Question
Share on Google+
5 Replies


chunk1978
100+
P: 224
hi there... i've got a page that includes CSS, JavaScript and HTML codes... i'd like to know which Doctype i should use at the start...

currently there is no Doctype included at all, and it seems to work fine on Windows IE7 and Mac Safari 2, but shouldn't i include a Doctype? perhaps i'll run into some problems later if i don't include one? and which Doctype should i include?

thanks
nevermind... i tested my pages at w3c... and i don't mind having some crazy code... as long as it works... i mean, i also tested Apple.com and Microsoft.com and they had "errors" with their doctypes too... so, i sure don't mind if i have 20 "errors" on my page that work regardless... that being said, i do realize that doctypes are important, but after months of work and 3000+ lines of working code, i can live without...
Apr 30 '07 #2

Banfa
Expert Mod 5K+
P: 8,916
You should include a doctype. The problem is that without a doctype IE will work in quirks mode, this means that it will not be interperating your CSS in that same way and every other browser, specifically it will be using the broken box model.

This is not just about fixing errors now, it is also about making your site easier to maintain in the future.

If you can use the XHTML 1.0 strict DOCTYPE, alternitively use the XHTML 1.0 or HTML 4.01 transitional doctype which are a little less exacting.
Apr 30 '07 #3

chunk1978
100+
P: 224
You should include a doctype. The problem is that without a doctype IE will work in quirks mode, this means that it will not be interperating your CSS in that same way and every other browser, specifically it will be using the broken box model.

This is not just about fixing errors now, it is also about making your site easier to maintain in the future.

If you can use the XHTML 1.0 strict DOCTYPE, alternitively use the XHTML 1.0 or HTML 4.01 transitional doctype which are a little less exacting.
hi Banfa... i actually tried to include a doctype, and parts of my page displayed wrong... it seems the closest doctype to the 3000+ lines of code i have now is HTML 4.01 Transitional, as it produced the least amount of errors when i validated the page... but if i included the doctype, my page wouldn't center correctly... i wouldn't mind fixing most of the 20 errors and including a doctype, but the w3c validator seems crazy, like it selects errors in the code when they really are not errors at all...
Apr 30 '07 #4

Banfa
Expert Mod 5K+
P: 8,916
The reason you page displays incorrectly is that you have designed using the broken box model, so you have taken account of it's brokenness in your design.

Unfortunately this means that all the browsers that do not have a broken box model (in other words all of the except IE) will be displaying you site incorrectly because of the difference in the box model.

If the validator says it's an error then it's an error and is not conforming to the standard in some way.


Look you have clearly done a lot of work and it sounds like it would be a lot of work to alter things. I am not going to say you must do this change that is your decision. If you have the time it would be nice to do it, and you code will be better quality if you do it.

What you should do is get hold of several different browsers and check what the site looks like in IE, Firefox, Opera, Safari etc.


The other thing you should do is learn this 1 leasson: the time to add you DOCTYPE is the start of the project, not the finish. If you have it in from the word go and validate regularly then you will not have this problem.
Apr 30 '07 #5

chunk1978
100+
P: 224
The reason you page displays incorrectly is that you have designed using the broken box model, so you have taken account of it's brokenness in your design.

Unfortunately this means that all the browsers that do not have a broken box model (in other words all of the except IE) will be displaying you site incorrectly because of the difference in the box model.

If the validator says it's an error then it's an error and is not conforming to the standard in some way.


Look you have clearly done a lot of work and it sounds like it would be a lot of work to alter things. I am not going to say you must do this change that is your decision. If you have the time it would be nice to do it, and you code will be better quality if you do it.

What you should do is get hold of several different browsers and check what the site looks like in IE, Firefox, Opera, Safari etc.


The other thing you should do is learn this 1 leasson: the time to add you DOCTYPE is the start of the project, not the finish. If you have it in from the word go and validate regularly then you will not have this problem.
broken box model doesn't sound very nice... but my site works great in Firefox, Camino, Safari, and IE7... but for sure lesson learned... next time i'll start with a doctype ;-)
Apr 30 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.