Home  >  Article  >  Web Front-end  >  What are the new tags in html5? New tag applications in html5

What are the new tags in html5? New tag applications in html5

不言
不言Original
2018-08-08 10:26:5011279browse

html5 is the fifth revision of Hypertext Markup Language (HTML), so some new tags have been added to html5. So, what are the new tags in html5? What I will introduce to you below is the new tags added in html5 compared to html.

1. New tags in HTML5

Header - can represent a container for introduction content, or a set of navigation links.

Nav - The content of the label is mainly used for navigation.

Article - identifies the main content in the page. Taking a blog as an example, each post is an important piece of content, and Article can be used to identify each post.

Section - Used to mark important sections on the page. This markup is similar to dividing a document into chapters.

Aside - Indicates that it is related to the main content of the page, but is not part of the page. It often indicates a related link.

Footer - Opposite to Header, it represents the footer of the document or chapter. For example, copyright information is placed in this tag.

Traditional div layout


    
    

Use the new tags in HTML5 to implement layout


    

2. Enhanced application of forms

In HTML 4, some simple form elements are provided to handle basic input. For certain types of input, such as date and time input, the interactive experience cannot meet the needs. Therefore, in order to get better results, you can only use javascript to write component implementations. Improved in HTML 5, adding new form elements to provide more input types.

(1) Input's Type attribute expansion

search - presents a search box.

tel - Enter the phone number, you can use pattern and maxlength to limit the input to the appropriate

url - Enter the URL address.

email - Enter your email address.

date - Enter the date.

color - Enter color.

number - Enter a number.

range - Slider input

(2) Input form validation through attributes

required - Mark the current element as required.

pattern - Use regular expressions to validate form input.

(3) Other useful attributes of the Input element

autofocus - When the page loads, automatically focus on the current input element.

form - Associates an input element with a specific Form form.

placeholder - Input placeholder that prompts the user for input.

(4) HTML 5 new elements and special attributes contenteditable

progress - element represents a progress bar.

meter - Element representing a ruler. The maximum value max defaults to 1.

3/1060%

HTML 5 special attribute contenteditable, through which an ordinary element can be made editable.

这里的内容式可编辑的

3. Using audio and video

(1) audio (audio tag)

audio The attributes that control the behavior of elements are as follows

controls - This attribute controls whether to display the standard audio space.

autoplay - Whether to play automatically. Default false.

loop - Whether to loop. Default false.

preload - Preloading method. There are three situations: none means no preloading; metadata only loads the metadata of the audio; auto means preloading the entire audio. Default auto.

volum - volume, value between 0 - 1

Methods to play and pause audio

var audio = document.getElementById('audio')
audio.play() // 播放audio.pause() // 暂停

(2 ) video (video tag)

currentTime controls the time to start playing

Recommended related articles:

html5 basic tag (html5 video tag html5 new Tag usage)_html5 tutorial skills

##Summary of new elements and tags in HTML5

Introduction to new tags and attributes in HTML5

The above is the detailed content of What are the new tags in html5? New tag applications in html5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn