Jump to content

Html <!doctype> Declaration


ankur218

Recommended Posts

I was going through this HTML <!DOCTYPE> Declaration topic in w3schools. To an extent I was able to understand what it really means that we should add this before the <html> tag so as the browser knows which HTML version we are using or so. But then how will I myself know which version I am using? HTML 4.01 or HTML 5, whether strict, or transitional or frameset? Also please tell me what this Strict, Transitional and Frameset means? I came across this example, can anyone in detail elaborate the meaning of it by breaking into parts and explaining me why it is done?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>Title of the document</title></head> <body>The content of the document......</body> </html> 

Thanks in advance!!

Link to comment
Share on other sites

Well, you know because you are the one writing the markup. You should know the differences between the two types of markup, HTML4 vs. 5, and determine what features you need. HTML5 only has one doctype and so there is only one set of standards to code against, but not all features are supported cross-browser, but enough of them are IMO that I have started using it, just for the convenience of how to write the DTD itself. If you use 4.01, then you should use strict. If you are trying to update an old site, then you can use transitional. If you are using frames, than frameset. edit: as for your example, if you aren't familiar with the most basic layout of a HTML document; DTD, head, body, then you should definitely review the basics of the HTML tutorial. There's nothing advanced in that example.

Link to comment
Share on other sites

@thescientist: Thanks a ton bro. I got my doubts clarified. I did understand that structure, but just wanted to know if I was right. Glad that you bailed me out :-) And yeah, you mean, it's better to use HTML 4 now than 5? Cheers!! :-)

Link to comment
Share on other sites

I was saying that I have moved onto using it, but only for the things that I know work consistently across all browsers. Basically I have started using it and have coded nothing different than the doctype for now. If I need to use one of it's features, I check for cross-browser compatibility first.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...