Some of the new attributes and functions of HTML5 make the code more concise. This is always a good thing and should be worthy of our praise. I hope this HTML5 article will be of some help to you
1. New Doctype declaration
The declaration of XHTML is too long. I believe that few front-end developers can write this Doctype declaration by hand.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The Doctype declaration of HTML5 is very short. I believe you can remember it immediately after seeing this declaration. You don’t have to waste your brain cells to remember the long and a bit abnormal Doctype declaration of XHTML.
<!DOCTYPE html>
The short DOCTYPE statement of HTML5 allows modern browsers such as Firefox, Chrome and browsers such as IE6/7/8 to enter (quasi) standards mode. You may be surprised that IE6/ 7 can actually support HTML5 Doctype. In fact, IE will enter standards mode as long as the doctype conforms to this format.
2.
<img alt="About image" src="path/to/image"> <h6>Image of Mars.</h6>
Look at the following simple code:
Unfortunately, here The h6 tag seems to have nothing to do with the img tag, and the semantics are not clear enough. HTML5 realized this and adopted the
<figure> <img alt="About image" src="path/to/image"> <figcaption> <h6>This is an image of something interesting. </h6> </figcaption> </figure>
3. Redefine
Not long ago, I used the tag to create a subtitle related to the logo . However, the tag has been redefined in HTML5 to make it more semantic. The font size of will become smaller. It would be a good idea to think about using this tag for copyright information at the bottom of the website. .
4. Removed the type attribute of Javascript and CSS tags
Usually you will add the type attribute to and