2011-05-01 51 views
0

我不明白html中的文檔類型。html中doctype的內容

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd"> 

請問您能解釋一下這裏的每件事情是什麼意思。

+1

你見過HTML 5的文檔類型嗎?它是'<!DOCTYPE html>'。 – Oded 2011-05-01 18:05:03

回答

6
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
      "http://www.w3.org/TR/html4/strict.dtd"> 


!DOCTYPE - The document type declaration 
HTML - The root element is HTML, the type of document is HTML 
PUBLIC - Availability - this is a public doctype 
"-//W3C//DTD HTML 4.01//EN" - A formal identifier 
"http://www.w3.org/TR/html4/strict.dtd" - URI, here it is the location of the DTD 

about.com有進一步細分。

+1

[更好](http://www.blooberry.com/indexdot/html/tagpages/d/doctype.htm) – saplingPro 2011-05-01 18:12:16

1

是DOCTYPE的部分是:

Root element:    HTML 
DTD type:     PUBLIC 
Formal Public Identifier: "-//W3C//DTD HTML 4.01//EN" 
DTD URL:     "http://www.w3.org/TR/html4/strict.dtd"> 

但是,你真的沒有知道這一切意味着什麼。只需從W3C's recommended list of doctype declarations中選擇一個文檔類型聲明即可。