"HTML5 and CSS3 authoritative guide" Mechanical Industry Press
The difference between Chapter 2-HTML5 and HTML4
1.DOCTYPE Declaration
HTML4: <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3c.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">
HTML5: <! DOCTYPE html>
The above code we call the DOCTYPE statement. DOCTYPE is a shorthand for document type, which is used to describe what version of XHTML or HTML you are using.
The DTD (for example, XHTML1-TRANSITIONAL.DTD in the previous example ) is called the document type definition, which contains the rules of the document, and the browser interprets the identity of your page according to the DTD you define and shows it.
The DOCTYPE statement is an essential part of establishing a standard-compliant web page, and your logo and CSS will not take effect unless your XHTML determines the correct DOCTYPE.
2. Specify character encoding
HTML4: <meta http-equiv= "Content-type" content= "Text/html;charset=utf-8" >
HTML5: <meta charset= "UTF-8" >
Rules for element tagging in 3.HTML5
The elements that are not allowed to write end tags are: area, base, BR, col, command, embed, HR, IMG, input, keygen, link, meta, param, source, track, WBR; (Example: )
The elements that can omit the closing tag are: Li, DT, DD, p, RT, RP, optgroup, option, Colgroup, THEAD, Tbody, TFOOT, TR, TD, Th; (Example:<li>)
The elements that can omit all tags are: HTML, head, body, Colgroup, tbody; (example: an element exists implicitly, the head tag is also present in the document)
4. Properties that have a Boolean value
HTML4: <input type= ' checkbox ' checked= ' checked ' >
HTML5: <input type= ' checkbox ' checked>
Similar to the following: readonly, disabled
5. Attributes omit quotation marks
Html4:<input type= ' text ' >
Html5:<input type=text>
Note: You can omit a property when it does not include an empty string, <, >, =, ', '
"HTML5 and CSS3 authoritative guide" reading notes