From HTML4.01 to HTML5 is not a revolutionary upgrade, but a specification-to-habit compromise, so HTML5 does not bring too much impact to the developers, and the transition to HTML5 is very easy. On the other hand, it also adds a lot of useful new features.
such as HTML5 's grammatical changes. The biggest feature of these changes is: HTML5 more tolerant! HTML5
The specification is designed to be the largest of the arrows on the internet everywhere on the nonstandard page.
To sum up, there are several syntactic changes in the HTML5:
1. Label is no longer case-sensitive
Example:<p> This is a text </P>
The end of the P tag is capitalized, but this conforms to the HTML5 writing specification.
2, the element can omit the end tag
HTML5 is very tolerant, allowing some HTML5 elements to omit the end tag, even allowing the HTML5 element to omit both the start tag and the end tag. Specifically, the omitted tags in HTML5 can be divided into the following three kinds:
(1) empty element syntax Tags: area, base, BR, col, command, embed, HR, IMG, input, keygen, link, Mata, param, source, wbr.
(2) The elements of the closing tag can be omitted: colgroup, DT, DD, Li, optgroup, option, p, RT, RP, THEAD, Tbody, TFOOT, TR, TD, Th.
For example:<p> This is a piece of text
The above code is only the start tag, there is no end tag, but in the HTML5 is compliant.
(3) The elements of all tags can be omitted: HTML, head, body, tbody.
<! DOCTYPE html>
<title> examples </title>
<p> then a paragraph of text
<ol>
<li> This is a list
<li> This is a list
</ol>
The above code tag does not have the P tag and Li's end tag, not even the
3. Attributes that allow attribute values to be omitted
XHTML requires all attribute names to be lowercase for all elements, and all attributes must also have write property values, not shorthand. All attribute values must be in double quotation marks.
HTML5 allows some of the iconic attributes to omit attribute values. For example
<input checked type= "checkbox" >
<input readonly type= "text" >
<input display type= "text" >
4. Allow attribute values not to use double quotes
Traditional XHTML requires attributes according to XML specifications, all attribute values must be quoted in quotes, but HTML5 allows property values to be given directly, even if not enclosed in quotation marks.
For example:
<select>
<option value=java> This is a drop-down menu </option>
<option selected Value=ee> It's a drop-down menu </option>
</select>
It is necessary to note that if the property value of a property contains a property value such as a space that can easily confuse the browser, then HTML5 still recommends using quotation marks to enclose this particular attribute value. If we have a picture in my images directory, if I use the following code to define the picture directly
The above code is very easy to cause the browser misunderstanding, the browser will mistakenly assume that the SRC attribute is my. This way the program will not resolve to the real picture. The code should now be changed to
That's what I've learned about the new features of HTML5.
HTML5 new Features