16

I use a fantastic javascript organization tree generator named "ECOTree" but the drawing does not work when I put <!DOCTYPE html>. Labels in the boxes are not put in the boxes correctly.

You can see the error at sample1.htm on the site below. Could anybody suggest me how to fix. http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=16192

(In order to follow my project rule, I have to define <!DOCTYPE html>)

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
zono
  • 8,366
  • 21
  • 75
  • 113
  • 6
    ` ` is the doctype for the document. It basically tells the web browser how to render the page (there are different doctypes). If the page renders improperly with a correct doctype, that means that the page wasn't correctly coded. – Blender Feb 19 '12 at 05:23
  • 5
    possible duplicate of [What's up, Doctype?](http://stackoverflow.com/questions/414891/whats-up-doctype) – animuson Feb 19 '12 at 05:31
  • Thaks a lot! As you said, this question is duplicated one. I will read it.(It may be tough one to find unsupported codes from "ECOTree" but I will try it.) – zono Feb 19 '12 at 06:24
  • Fixed it thanks to the message-board in ECOTree's site.Additionally, I learned what does "DOCTYPE" mean thank to you. – zono Feb 19 '12 at 06:50
  • http://reference.sitepoint.com/html/doctypes – Jawad Feb 19 '12 at 08:08
  • -1 Searched SO with ' What does it mean?' found over 600 results! – toesslab May 03 '14 at 08:29

5 Answers5

29

<!DOCTYPE html> is the explicit Document Type Declaration.

From the linked page:

The DOCTYPE Declaration (DTD or Document Type Declaration) does a couple of things:

  1. When performing HTML validation testing on a web page it tells the HTML (HyperText Markup Language) validator which version of (X)HTML standard the web page coding is supposed to comply with. When you validate your web page the HTML validator checks the coding against the applicable standard then reports which portions of the coding do not pass HTML validation (are not compliant).
  2. It tells the browser how to render the page in standards compliant mode.

#2 is a very important reason for using it.

<!DOCTYPE html>, specifically, is the correct declaration for HTML5, and should be used pretty much from here to the near future. You can still use legacy strings or obsolete permitted strings, but the previously written format is all that is required in HTML5. On a further note, this DTD will cause all modern browsers dead link to switch to their standards (compliance) mode, even if they don't support HTML5.

Here's some more info:

Activating Browser Modes with Doctype & Choosing a Doctype (same page)
World Wide Web Consortium (they make web standards)

rockerest
  • 10,412
  • 3
  • 37
  • 67
  • 1
    @thirtydot "[we should be thinking for ourselves when deciding what specific page is a good reference, not relying on a blanket statement made by a 3rd party](http://meta.stackexchange.com/a/87680)." If a link provides information that is not incorrect (as the link did), and is easy to absorb for someone who obviously has no idea about the subject, then it is a good link. The link you provided is like getting hit in the face with with a book. Quality information, I'm sure, but on the level of a theoretical white paper as to layman usefulness. – rockerest Feb 19 '12 at 07:37
  • "`html` is the declaration for HTML5" Uh, no, not really. In a valid DOCTYPE declaration, it just means the root element of the document is ``. The sequence ` ` is taken as a whole by the HTML5 spec. – BoltClock Feb 19 '12 at 12:39
  • I removed the w3schools link mainly because it doesn't even *mention* the HTML5 doctype. In 2012, that's just no good. Linking to w3schools is almost never a good idea. Their information is often flawed in some way, and even if it's not, you're less likely to get upvotes and more likely to get downvotes (personal experience). To mitigate your concerns that the link I provided is too complicated, you could update the link to http://hsivonen.iki.fi/doctype/#choosing, which gets straight to the important part. Thanks for not rolling back your answer. – thirtydot Feb 19 '12 at 14:33
  • @BoltClock I made that paragraph more clear as to what I meant. Thanks for pointing that out. – rockerest Feb 20 '12 at 05:33
14

<!DOCTYPE html> is not a "Document Type Declaration".

A "Document Type Declaration" is an SGML concept for signalling the mark-up syntax and vocabulary for the mark-up that follows. <!DOCTYPE html> does not conform to the requirements of that. This is unlike <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> which is a SGML conforming Document Type Declaration.

<!DOCTYPE html> does not indicate an HTML5 document.

Although HTML5 conforming documents in the text/html serialization are required to have <!DOCTYPE html> at their start, it does not follow that the converse is true. I.e. a document can have <!DOCTYPE html> at its start and not be an HTML5 document. For example, it is intended that all future versions of HTML will use the same character sequence at their start. So it might indicate an HTML5 document, or an HTML6, HTML7 etc. document, an HTML5+RDFa-lite document, or a document from an entirely competing standard.

The HTML5 spec describes <!DOCTYPE html> as "a required preamble", and that's much closer to the mark.

It's just the shortest character sequence that will request to legacy as well as future browsers that the browser should handle the HTML of the document using its most modern HTML processing mode. It was chosen as the conforming preamble for HTML5 for solely that reason.

If it can be said to have any meaning at all, it is that it indicates that the document was created or last refactored around about 2007 or later. Again, the converse does not necessarily apply. A document not containing <!DOCTYPE html> does not imply that the document was created before any particular date.

Alohci
  • 78,296
  • 16
  • 112
  • 156
  • 1
    For posterity: the World Wide Web Consortium's [list of document type declarations](http://www.w3.org/QA/2002/04/valid-dtd-list.html#DTD). Explicitly noting that ` ` _is_ a Document Type Declaration, though not officially standardized yet. In addition, the link in the answer above [explicitly states that other DTDs are obsolete when creating HTML documents](http://www.w3.org/html/wg/drafts/html/master/syntax.html#obsolete-permitted-doctype) – rockerest Sep 17 '13 at 17:28
  • Quote from that website: "The simplest and most reliable doctype declaration to use is the one defined in HTML5: ` `" – Greg Wozniak Apr 13 '21 at 10:25
2

“<!DOCTYPE html>” What does it mean?

It means that your webpage will be rendered as per html5 standards, obviously you if you have something that browser doesn't support then you need to use a polyfill for that.

animuson
  • 53,861
  • 28
  • 137
  • 147
defau1t
  • 10,593
  • 2
  • 35
  • 47
1

It tells the version i.e the page is written in HTML5. Basically it is the instruction to the web browser about what version of HTML the page is written in and even tell web browser how to render the page.

Following are list of HTML Doctype Declarations List:

http://www.w3.org/QA/2002/04/valid-dtd-list.html

1

⦁ The term DOCTYPE tells the browser which type of HTML is used on a webpage. In turn, the browsers use DOCTYPE to determine how to render a page. Failing to use DOCTYPE or using a wrong DOCTYPE may load your page in Quirks Mode. See example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">.
kleopatra
  • 51,061
  • 28
  • 99
  • 211
tutu
  • 11
  • 1