tags:

views:

54

answers:

3

There are plenty of threads explaining what Doctype to choose, but I can't find any explaining the actual syntax. Take for example:

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

In particular:

  • Can PUBLIC be replaced with other values and what does it mean?
  • Why does the url need to be surrounded with quotes?
  • What is the "-"?
  • Why is the first string separated by two slashes rather than 1?
  • Does the EN stand for English? If so, why do websites also use lang=en?
+2  A: 

While it does not answer all of your questions, but I think it's a good start. Wikipedia is your friend. ;)

http://en.wikipedia.org/wiki/Document_Type_Declaration

p.s. For the double quote question being left out, I think the quotes are there in order to interpret the strings with whitespaces correctly

shinkou
+1  A: 

Nice question. I never really thought twice about it.

I found http://www.blooberry.com/indexdot/html/tagpages/d/doctype.htm that explains each section in detail.

sdolan
+1  A: 

Why is the first string separated by two slashes rather than 1?

The SGML syntax is "Owner//Keyword Description//Language".

But in practice, it's irrelevant, as browsers don't actually use SGML parsers for HTML. DOCTYPE is just a switch to decide between quirks mode and standards mode.

dan04