Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explanation of the Doctype Syntax

Tags:

doctype

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?
like image 668
Casebash Avatar asked Jun 22 '10 03:06

Casebash


2 Answers

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

like image 188
shinkou Avatar answered Oct 17 '22 01:10

shinkou


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.

like image 20
Sam Dolan Avatar answered Oct 17 '22 01:10

Sam Dolan