What is a DOCTYPE and what does it do?
Author: Stefan Vervoort | Please Comment!When a browser scans your website, the first thing it looks for is its DOCTYPE. It helps render your website the proper way. Ever realized that a browser isn’t a real life guy that can guess in what language and type it is written? Well, a browser is just a tool for people to view your website and if it doesn’t know what and how it has to show a page, there can be some problems in layout. So when there’s a wrong, outdated or no DOCTYPE at all, your HTML, CSS or DOM codes are rendered as they where designed in the late 90’s. That’s not something a web developer like you want, right?
Most new, major browsers render the page the way the DOCTYPE says them to do. With major browsers I mean Internet Explorer 5.0 and up and of course Mozilla’s Firefox 1.0 and up. It is very logical new upcoming browsers will be using DOCTYPES as well. Only Opera doesn’t use DOCTYPEs, they always render a webpage a standard-compliant way.
So, you know why to use a DOCTYPE, but what is a DOCTYPE really. A DOCTYPE describes a document type definition (DTD). This is a machine-readable document that gives the browser the information it needs to display the right way as defined in the DOCTYPE. Example; if the DOCTYPE refers to XHTML 1.0 transitional, it get the information the XHTML 1.0 transitional DTD provides to proper render the webpage.
I hope you understand now what a DOCTYPE is. As a web developer you have to make choices and you might not know how you can use a DOCTYPE and when. In the next topic, I’ll show you the DOCTYPES you can use. You can also visit the W3C’s site for more information.
Different types of DOCTYPES
Of course, there are differences between HTML 4.01, XHTML 1.0 and XHTML 1.1. The DOCTYPE you have to choose depends on the language you have chosen.
HTML 4.01
Strict
Transitional
Frameset
XHTML 1.0
Strict
Transitional
Frameset
XHTML 1.1
Conclusion
Now, do you understand why you need to add a DOCTYPE? If not, please read my article again or leave a comment on this blog. In my opinion, this is a code everyone should use, especially if you think standards are important for the development of the web!
Thanks for reading this article. Please send me an email or leave a comment.









Loading...
4:24 pm on June 11th, 2007
Very informative. Will help beginners out alot.
12:30 pm on June 12th, 2007
Nice and helpful article.Thanks for sharing with us.
5:38 am on June 18th, 2007
Hi,
Thanks for your artical, i learnt about DOCTYPE you explained very well.
Thanks once again,
jonathan
10:37 am on June 18th, 2007
Thanks for your kind replies. A new article is coming up!
Edit: Visit the new article here!
5:17 am on June 21st, 2007
Maybe you should explain why there are different doctypes and that you should allways try to use Strict.
5:26 am on June 21st, 2007
The article is on the ‘DOCTYPE’ subject, not on which language and type you should use. Thanks for your comment.
4:47 am on June 23rd, 2007
thank you for this information!
1:46 am on July 5th, 2007
Hello
Great book. I just want to say what a fantastic thing you are doing! Good luck!
Bye
9:40 pm on August 2nd, 2007
thnx… nice site
3:55 pm on August 4th, 2007
nice site… look on my site
6:10 am on August 6th, 2007
Hello,
Thanks for your comments guys!
@Music-Band: Thanks for your offer but an adult website isn’t the subject this blog is about. If you have any other sites, other than gambling, adult, we can talk.
7:04 am on August 6th, 2007
That’s how it is. ,
12:47 am on August 7th, 2007
Hey, i was surfing the web and i saw your blohg, pretty cool. May i link u from mysite?
3:40 pm on August 18th, 2007
Thats really cool information about Doc type files…and descriptions…
Thanks !!
1:46 pm on October 6th, 2007
Thank you for sharing!
5:16 pm on May 26th, 2008
very interesting and informative! tnx pal!
4:55 am on May 27th, 2008
Thank you very much for your clear explanation of what a DOCTYPE is. I will take a look at my site to make sure I used the right DOCTYPE! Thanks
1:07 pm on June 20th, 2008
Nice Article Dude
9:18 am on August 3rd, 2008
nice article frnd
8:44 pm on August 12th, 2008
Thanks for the information I never realized that the doc type was used to help render your website with browsers. Now thinking about it makes sense to have somewhat of a universal language that is accepted by multiple browsers.
1:17 am on August 23rd, 2008
Very informative, I was always looking for a decent article on this subject. I appreciate your information and look forward to learning more from your blog.
4:03 pm on August 25th, 2008
Great information i think most people with sites don’t even realize the importance of this and having a validated website.
5:09 pm on August 28th, 2008
Great information i think
8:47 pm on October 11th, 2008
Well, I havn’t still understood why are people using Transitional DOCTYPES for new projects? How can it make our work easier…
7:57 am on October 20th, 2008
Very enlightening article, thanks for sharing, this was pretty useful.
11:09 am on October 20th, 2008
I have been a frequent visitor of this blog for some time now, so I thought it would be a good idea to leave you with my thanks.
Regards,
Deana
6:18 pm on October 25th, 2008
DOCTYPE drove me nuts back when I started validating documents (and did not pass the test), because I had chosen the wrong type for the code I wrote. Looking back, I guess most folks would have done the same. Have you?
7:17 pm on November 17th, 2008
I enjoyed reading this article, its very interesting and i really learnt from it. Thanks for this great share.