I just started learning it and I don’t quite understand this thing. How should I use DOCTYPE?
I have seen that the words "DOCTYPE" on many current websites start with . I would like to ask, if I build a website now, can I use this DOCTYPE? Can it achieve good compatibility?
Just use this, everything is compatible.
For the reason why ie6 can parse, see this link: http://i.wanz.im/2010/05/28/why_doctype_html/
It is very useful. Professionally speaking: if the first line of the page is not When this happens, the IE browser, CSS, and JS will be expressed in a non-standard way, and the page will not be the result that everyone expects.
If this appears in the first line, then IE will parse it according to the agreed specifications, and the page will be the one everyone expects.
This is the statement of html5. If you choose to use html5 development, then use it
Specifically choose which statement, According to the needs of the website
The following is a detailed introduction of the W3C statement on . You can check it out
http://www.w3school.com.cn/tags/tag_doctype.asp
Want to advance Just use HTML5.
<!Doctype HTML>