Home > Web Front-end > H5 Tutorial > Compilation of common skills in html5 basic tutorials

Compilation of common skills in html5 basic tutorials

PHPz
Release: 2018-09-29 14:41:34
Original
1382 people have browsed it

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">
Copy after login

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>
Copy after login

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.

tag

<img alt="About image" src="path/to/image"> 
<h6>Image of Mars.</h6>
Copy after login

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

tag. When the
is used in combination with the
tag, the h6 tag and the img tag can be combined, and the code becomes more semantic.

<figure> 
<img alt="About image" src="path/to/image"> 
<figcaption> 
<h6>This is an image of something interesting. </h6> 
</figcaption> 
</figure>
Copy after login

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

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template