473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Which Doctype Should Be Used?

chunk1978
224 100+
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
5 1931
chunk1978
224 100+
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
9,065 Expert Mod 8TB
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
224 100+
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
9,065 Expert Mod 8TB
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
224 100+
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

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

Similar topics

13
by: Tjerk Wolterink | last post by:
Hello i've an xsl stylesheet that must support xhtml entities, my solution: ---- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xsl:stylesheet > <xsl:stylesheet version="1.0"...
2
by: Colin McGarry | last post by:
After changing some "old" web pages into CSS I noticed big differences between mozilla and IE rendering. I finally noticed that the document type was HTML 3.2. I copied a more recent tag from...
25
by: Viken Karaguesian | last post by:
Hello all, I'm somewhat of a newbie to webscripting. I've made a couple of websites in the past with WYSIWYG software, but now I'm much more interested in manual scripting. I have some...
29
by: AndyZa | last post by:
According to the w3c specs a web page is not valid if the DOCTYPE declaration is missing. So, if I add the following doctype to my pages they will be "compliant": <!DOCTYPE HTML PUBLIC...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.