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

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

Aug 08, 2018 am 10:26 AM

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

<body>
    <!-- 页头 -->
    <div class=&#39;header&#39;></header> 
    <!-- 导航 -->
    <div class=&#39;nav&#39;></div>
    <!-- 主体内容 -->
    <div class=&#39;main&#39;>
        <!-- 文章 -->
        <div class=&#39;article&#39;>
            <!-- 节 -->
            <div class=&#39;section&#39;></div>
        </div>
        <!-- 边栏 -->
        <div class=&#39;sidebar&#39;></div>
    </div>
    <!-- 页脚 -->
    <div class=&#39;footer&#39;></div></body>
Copy after login

Use the new tags in HTML5 to implement layout

<body>
    <header></header>
    <nav></nav>
    <div>
        <article>
            <section></section>
        </article>
        <aside></aside>
    </div>
    <footer></footer></body>
Copy after login

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

<input type=&#39;tel&#39; name=&#39;tel&#39; value="" placeholder="请输入手机号码" pattern=&#39;1[3-8][0-9]{9}&#39; title=&#39;请输入11位手机号&#39;>
Copy after login

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.

<progress value=&#39;30&#39; max=&#39;100&#39;></progress>
Copy after login

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

<meter value="3" min="0" max="10">3/10</meter><meter value="0.6">60%</meter>
Copy after login

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

<p contenteditable="true">这里的内容式可编辑的</p>
Copy after login

3. Using audio and video

(1) audio (audio tag)

<audio controls>
    <source src="vincent.mp3" />
    <source src="vincent.ogg" />
    您的浏览器不支持 audio 标签</audio>
Copy after login

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(&#39;audio&#39;)
audio.play() // 播放audio.pause() // 暂停
Copy after login

(2 ) video (video tag)

currentTime controls the time to start playing

<video width="400" height="300" controls currentTime=&#39;5&#39;>

    <source src="dizzy.mp4#t=5" type="video/mp4" />  <!-- 从 5s 开始 -->
    <source src="dizzy.ogv#t=5,10" type="video/ogg" /> <!-- 从 5s 到 10s -->
    <source src="dizzy.webm#t=,15" type="video/webm"> <!-- 到 15s 结束 -->
    <p>您的浏览器不支持 HTML 5 视频</p></video>
Copy after login

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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run the h5 project How to run the h5 project Apr 06, 2025 pm 12:21 PM

Running the H5 project requires the following steps: installing necessary tools such as web server, Node.js, development tools, etc. Build a development environment, create project folders, initialize projects, and write code. Start the development server and run the command using the command line. Preview the project in your browser and enter the development server URL. Publish projects, optimize code, deploy projects, and set up web server configuration.

What exactly does H5 page production mean? What exactly does H5 page production mean? Apr 06, 2025 am 07:18 AM

H5 page production refers to the creation of cross-platform compatible web pages using technologies such as HTML5, CSS3 and JavaScript. Its core lies in the browser's parsing code, rendering structure, style and interactive functions. Common technologies include animation effects, responsive design, and data interaction. To avoid errors, developers should be debugged; performance optimization and best practices include image format optimization, request reduction and code specifications, etc. to improve loading speed and code quality.

How to make h5 click icon How to make h5 click icon Apr 06, 2025 pm 12:15 PM

The steps to create an H5 click icon include: preparing a square source image in the image editing software. Add interactivity in the H5 editor and set the click event. Create a hotspot that covers the entire icon. Set the action of click events, such as jumping to the page or triggering animation. Export H5 documents as HTML, CSS, and JavaScript files. Deploy the exported files to a website or other platform.

What is the H5 programming language? What is the H5 programming language? Apr 03, 2025 am 12:16 AM

H5 is not a standalone programming language, but a collection of HTML5, CSS3 and JavaScript for building modern web applications. 1. HTML5 defines the web page structure and content, and provides new tags and APIs. 2. CSS3 controls style and layout, and introduces new features such as animation. 3. JavaScript implements dynamic interaction and enhances functions through DOM operations and asynchronous requests.

Is H5 page production a front-end development? Is H5 page production a front-end development? Apr 05, 2025 pm 11:42 PM

Yes, H5 page production is an important implementation method for front-end development, involving core technologies such as HTML, CSS and JavaScript. Developers build dynamic and powerful H5 pages by cleverly combining these technologies, such as using the &lt;canvas&gt; tag to draw graphics or using JavaScript to control interaction behavior.

How to make pop-up windows with h5 How to make pop-up windows with h5 Apr 06, 2025 pm 12:12 PM

H5 pop-up window creation steps: 1. Determine the triggering method (click, time, exit, scroll); 2. Design content (title, text, action button); 3. Set style (size, color, font, background); 4. Implement code (HTML, CSS, JavaScript); 5. Test and deployment.

What application scenarios are suitable for H5 page production What application scenarios are suitable for H5 page production Apr 05, 2025 pm 11:36 PM

H5 (HTML5) is suitable for lightweight applications, such as marketing campaign pages, product display pages and corporate promotion micro-websites. Its advantages lie in cross-platformity and rich interactivity, but its limitations lie in complex interactions and animations, local resource access and offline capabilities.

What Does H5 Refer To? Exploring the Context What Does H5 Refer To? Exploring the Context Apr 12, 2025 am 12:03 AM

H5referstoHTML5,apivotaltechnologyinwebdevelopment.1)HTML5introducesnewelementsandAPIsforrich,dynamicwebapplications.2)Itsupportsmultimediawithoutplugins,enhancinguserexperienceacrossdevices.3)SemanticelementsimprovecontentstructureandSEO.4)H5'srespo

See all articles