Click here to Skip to main content
15,879,490 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I am designing a website with HTML, CSS, and JQuery. I am not using HTML5.
My dreamweaver application has automatically added a DOCTYPE like this.

HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


I don't know whether this is the right DOCTYPE which I should use. Can I avoid it, and declare like HTML5 ? <!DOCTYPE HTML>
Posted
Comments
Sergey Alexandrovich Kryukov 24-Feb-15 1:07am    
What, reading the standards is a great sacred knowledge? :-)
Short answer: yes, you can. But XHTML has great benefits.
—SA

1 solution

XML
Like any language, HTML5 has a grammar and a vocabulary.
Grammar
<!DOCTYPE html> goes at the top of every HTML5 page.
Vocabulary
The HTML5 word <!DOCTYPE html> means "this page is written in HTML5" as opposed to, say HTML 4.01.
Why, you ask, don't they just write <HTML5> or even a zesty <!HTML5>? I have absolutely no idea. Still it's better than what they had before. Here's an example of one common type of XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Hopefully the doctype declaration in HTML5 won't turn into the crazy mess it did with XHTML and previous versions of HTML. Those in charge of such things say it won't, but time will tell.
So now you learned three things:
How to view the source code of a page, an important tool.
You know one word in HTML5: <!DOCTYPE html> = "HTML5"
and one grammar rule: <!DOCTYPE html> goes at the top of every page.


XML
Definition and Usage
The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag.

The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.

In HTML 4.01, the <!DOCTYPE> declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.

HTML5 is not based on SGML, and therefore does not require a reference to a DTD.

Tip: Always add the <!DOCTYPE> declaration to your HTML documents, so that the browser knows what type of document to expect.



Ref.
http://www.w3schools.com/tags/tag_DOCTYPE.asp[^]
http://www.html-5-tutorial.com/doctype.htm[^]
https://msdn.microsoft.com/en-us/library/ie/ms535242(v=vs.85).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900