search
HomeWeb Front-endFront-end Q&AWhat are the new tags in html5

What are the new tags in html5

Nov 23, 2022 pm 06:55 PM
html5

HTML5 new tags: canvas, audio, video, source, embed, track, datalist, keygen, output, article, aside, bdi, nav, mark, rt, rp, ruby, time, wbr, etc. . The canvas tag can define graphics, the audio tag can define audio content, video can define video, source can define multimedia resources, and embed can define embedded content, etc.

What are the new tags in html5

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

HTML5 is the latest version of HTML, which was customized by the W3C in 2014. Enhanced browser native functions reduce browser plug-in (such as flash) applications, improve user experience satisfaction, and make development more convenient. HTML has undergone tremendous changes from 1.0 to 5.0, from a single text display function to a multimedia display function with pictures and texts. After many years of improvement, many features have developed into a very important markup language.

New tags in html5

HTML5 adds some new structural tags, multimedia tags and form tags. Let me introduce it to you below.

New element

##TagDescription Tags define graphics, such as charts and other images. The tag is based on the JavaScript drawing API

New Multimedia Elements

TagDescriptionDefine audio content####Define multimedia resourcesDefine embedded content, such as plug-ins. Specifies an external text track for media such as New form element
Define video (video or movie)

##TagDescriptionDefine the option list. Use this element in conjunction with an input element to define the possible values ​​of the input. Specifies the key pair generator field to use for the form. Define different types of output, such as script output.

New semantic and structural elements

##TagDescription
Define an independent content area of ​​the page. Define the sidebar content of the page. Allows you to set a piece of text independent of the text direction setting of its parent element. Define a command button, such as a radio button, check box, or buttonUsed to describe the details of a document or a certain part of a document####
is specified independently of streaming content (images, charts, photos, code, etc.).
Define the title of the
element
Define the footer of section or document.
Defines the header area of ​​the documentDefine text with tokens. Define weights and measures. Use only for measurements with known maximum and minimum values. The part that defines the navigation link. Define the progress of any type of task. Define ruby ​​comments (Chinese phonetic or characters). Defines the interpretation or pronunciation of a character (Chinese phonetic phonetic or character). is used in ruby ​​comments to define the content displayed by browsers that do not support ruby ​​elements. Define the section (section, section) in the document. Define the date or time. Specifies where in the text it is appropriate to add line breaks.
Define a dialog box, such as a prompt box
The tag contains the title of the details element
##

html5 tag usage example

(1) Define navigation link


It is also a meaningful tag. It does not mean that adding this tag somewhere will create a navigation style. These are just meaningful p. Add the menu tag

html code:

<header>
    <p>这是一个header部分</p>
    <nav>    <!--导航链接标签-->
        <ul>    <!--配合ul使用-->
            <li>首页</li>
            <li>关于</li>
            <li>产品</li>
            <li>联系</li>
        </ul>
    </nav>
</header>

css code:

/*定义nav的高和颜色*/ 
nav{
    height:30px;
    background-color:#F33;
    margin-top:100px;}
/*正常设置li的样式*/
li{
    list-style:none;
    float:left;
    width:100px;
    height:30px;
}

In this way, only p can be used before The menu layout is

(2) Define the article tag

You can use the article Block tag is used to write articles, so use this tag to write articles in the section section. It can be used together with

html code:

<article><!--文章块p-->
  <h2 id="文章标题">文章标题</h2><!--标题-->
  <p>文章内容文章内容文章内容文章内容文章内容文章内容
  <br>
  文章内容文章内容文章内容文章内容文章内容文章内容<br>
  文章内容文章内容文章内容</p>
</article> 

css style:

article{
	background-color:#F33;
	width:500px;
	text-align:center;  /*水平居中*/  
	margin:0px auto;
}

This way you can write an article

(3) Define the grouping of media content and their titles

A. This tag can be used in conjunction with its matching tag

, but the title

<figure>
    <figcaption>标题</figcaption><!--配套-->
    <p>标题内容</p>
</figure>

B must be written in the middle of

. It can also be used in combination with

, where
is used to write the title, while
is used to write the content. The display effect is also different from the effect of matching use
<figure>
    <dt>标题1</dt>
    <dd>标题内容</dd>
</figure>

(4) Define a dialog box or window

You can also use the dd and dt tags in this tag, the title and content of the dialog box, the dialog box has The first attribute is open, and the compatibility of this tag is not very good

<dialog open>
          <dt>1问题</dt>
          <dd>1答案</dd>
          <dt>2问题</dt>
          <dd>2答案</dd>
</dialog>

 

(5) Define a list or menu of commands

A. This tag can be used together with li

<menu>
         <li>定义列表</li>
         <li>定义列表</li>
         <li>定义列表</li>
</menu>

B. You can add your own content to the right-click (only compatible with Firefox)

Union (define commands/menu items that the user can call from the popup menu) tag using

<menu type="context" id="cai">
            <!--label是右键后显示的菜单项,onclick是选中菜单后执行的代码--> 
            <menuitem label="菜单一" onclick="alert(&#39;这是菜单一&#39;)" icon="右键单击显示的图片"></menuitem>
                   
</menu>
<span contextmenu="cai">单击我试试</span>

The desired menu item appears after right-clicking

Click the menu item and the content will pop up

(6) Title group

You can write some combinations of titles

for common use
<hgroup><!--标题组-->
        <h3 id="标题">标题</h3>
        <h3 id="标题">标题1</h3>
        <h3 id="标题">标题2</h3>
        <h3 id="标题">标题3</h3>
</hgroup>

# #(7) Define small text

This tag is actually similar to other bold tags

<small>法律条文</small>
<small>联系我们</small>
<small>客户意见</small>

(8) Define the details of the element

The content inside can be used with the title and content tags

<details>
        <dt>问题</dt>
        <dd>解答</dd>
        <dt>问题</dt>
        <dd>解答</dd>
        <dt>问题</dt>
        <dd>解答</dd>
</details>  

Click on the details to see the title And the content is

(9) Define ruby ​​comment

If you encounter a word you don’t recognize, you can use this Annotate Pinyin, but some compatibility is not very good, you can modify it at that time

<ruby>夼<rp>(</rp><rt>kuang</rt><rp>)</rp></ruby>
<!--<rp>是能够兼容的时候让括号不可见,不能兼容的时候让括号可见,rt是进行这是的内容-->

(10) Define the measurement within the predefined range

There are several attribute values, min="" max="" value="" low="" high="", where low and high are ranges. When the value range exceeds, different effects will be displayed

<meter min="0" max="10" value="4" low="2" high="7">

After the value value exceeds the range

<meter min="0" max="10" value="8" low="2" high="7">

(11) The label of the progress bar

<progress id="jindu" max="100" value="0"></progress>进度条

The maximum value is the length of the progress bar, and the value value is the displayed progress. Use it to create a dynamic progress bar

<progress id="jindu" max="100" value="0"></progress>进度条
<script>
    var pro = document.getElementById("jindu");
    setInterval(function(){ pro.value+=1;},1000);    //间隔1秒它的值加1
</script>

The progress bar can be completed in this way, right? It’s much better than writing only in js. Different browsers have different expressions

For more programming-related knowledge, please visit: Programming Learning! !

The above is the detailed content of What are the new tags 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
Frontend Development with React: Advantages and TechniquesFrontend Development with React: Advantages and TechniquesApr 17, 2025 am 12:25 AM

The advantages of React are its flexibility and efficiency, which are reflected in: 1) Component-based design improves code reusability; 2) Virtual DOM technology optimizes performance, especially when handling large amounts of data updates; 3) The rich ecosystem provides a large number of third-party libraries and tools. By understanding how React works and uses examples, you can master its core concepts and best practices to build an efficient, maintainable user interface.

React vs. Other Frameworks: Comparing and Contrasting OptionsReact vs. Other Frameworks: Comparing and Contrasting OptionsApr 17, 2025 am 12:23 AM

React is a JavaScript library for building user interfaces, suitable for large and complex applications. 1. The core of React is componentization and virtual DOM, which improves UI rendering performance. 2. Compared with Vue, React is more flexible but has a steep learning curve, which is suitable for large projects. 3. Compared with Angular, React is lighter, dependent on the community ecology, and suitable for projects that require flexibility.

Demystifying React in HTML: How It All WorksDemystifying React in HTML: How It All WorksApr 17, 2025 am 12:21 AM

React operates in HTML via virtual DOM. 1) React uses JSX syntax to write HTML-like structures. 2) Virtual DOM management UI update, efficient rendering through Diffing algorithm. 3) Use ReactDOM.render() to render the component to the real DOM. 4) Optimization and best practices include using React.memo and component splitting to improve performance and maintainability.

React in Action: Examples of Real-World ApplicationsReact in Action: Examples of Real-World ApplicationsApr 17, 2025 am 12:20 AM

React is widely used in e-commerce, social media and data visualization. 1) E-commerce platforms use React to build shopping cart components, use useState to manage state, onClick to process events, and map function to render lists. 2) Social media applications interact with the API through useEffect to display dynamic content. 3) Data visualization uses react-chartjs-2 library to render charts, and component design is easy to embed applications.

Frontend Architecture with React: Best PracticesFrontend Architecture with React: Best PracticesApr 17, 2025 am 12:10 AM

Best practices for React front-end architecture include: 1. Component design and reuse: design a single responsibility, easy to understand and test components to achieve high reuse. 2. State management: Use useState, useReducer, ContextAPI or Redux/MobX to manage state to avoid excessive complexity. 3. Performance optimization: Optimize performance through React.memo, useCallback, useMemo and other methods to find the balance point. 4. Code organization and modularity: Organize code according to functional modules to improve manageability and maintainability. 5. Testing and Quality Assurance: Testing with Jest and ReactTestingLibrary to ensure the quality and reliability of the code

React Inside HTML: Integrating JavaScript for Dynamic Web PagesReact Inside HTML: Integrating JavaScript for Dynamic Web PagesApr 16, 2025 am 12:06 AM

To integrate React into HTML, follow these steps: 1. Introduce React and ReactDOM in HTML files. 2. Define a React component. 3. Render the component into HTML elements using ReactDOM. Through these steps, static HTML pages can be transformed into dynamic, interactive experiences.

The Benefits of React: Performance, Reusability, and MoreThe Benefits of React: Performance, Reusability, and MoreApr 15, 2025 am 12:05 AM

React’s popularity includes its performance optimization, component reuse and a rich ecosystem. 1. Performance optimization achieves efficient updates through virtual DOM and diffing mechanisms. 2. Component Reuse Reduces duplicate code by reusable components. 3. Rich ecosystem and one-way data flow enhance the development experience.

React: Creating Dynamic and Interactive User InterfacesReact: Creating Dynamic and Interactive User InterfacesApr 14, 2025 am 12:08 AM

React is the tool of choice for building dynamic and interactive user interfaces. 1) Componentization and JSX make UI splitting and reusing simple. 2) State management is implemented through the useState hook to trigger UI updates. 3) The event processing mechanism responds to user interaction and improves user experience.

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment