1.1 Marking method in HTMl5
1. Content type
The file extension remains unchanged, it is still .htm or .htm, and the content type is "text/html"
2. DOCTYPE statement
<!DOCTYPE HTML>
3. Specify the encoding of characters
<meta charset = “utf-8”> (utf-8 is recommended)
1.2 HTML ensures compatibility with previous HTML versions
three aspects:
1. Marked elements can be omitted
The elements that do not allow the use of closing tags are: area, base, br, col, command, embed, hr, img, input, keygen, link, meta, param, source, track, wbr.
The end tag elements that can be omitted are: li, dt, dd, p, rt, rp, optgroup, option, colgroup, thread, tbody, tfoot, tr, td, th.
All marked elements that can be omitted are: html, head, body, colgroup, tbody.
2. Attributes with boolean
Reference code example:
<!—Writing only attributes without writing attribute values means that the attribute is true-->
<input type = “checkbox” checked>
<!—Attribute value= attribute name, which means the attribute is true-->
<input type = “checkbox” checked = “checked”>
3. Omit quotation marks
When the attribute value does not include empty strings, "<", ">", "=", single quotes, double quotes and other characters, the symbols on both sides of the attribute can be omitted.
<input type = text>
1.2 Marking example
<!DOCTYPE HTML>
<meta charset = “utf-8”>
<title>HTML5 markup example</title>
<p>This code is HTML5
<br/>Written in syntax
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn