Home  >  Article  >  Web Front-end  >  What are the new tags in html5

What are the new tags in html5

青灯夜游
青灯夜游Original
2022-11-23 18:55:219099browse

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.

5ba626b379994d53f7acf72a64f9b697 New element

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

New Multimedia Elements

TagDescriptionb97864c2e0ef2353a16c4d64c7734e92Define audio content##39000f942b2545a5315c57fa3276f220##e02da388656c3265154666b7c71a8ddcDefine multimedia resources39000f942b2545a5315c57fa3276f220 andb97864c2e0ef2353a16c4d64c7734e92d8e2720730be5ddc9c2a3782839e8eb6Define embedded content, such as plug-ins. 9bf7cbf2c39baa37076a22499de2f6edSpecifies an external text track for media such as 39000f942b2545a5315c57fa3276f220 and b97864c2e0ef2353a16c4d64c7734e92 elements. 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.
fc86e7b705049fc9d4fccc89a2e80ee3
aa983b9eb8086376f1f6481364a02e5a
be6d67dae90cc1ad6469079e163d0939

New semantic and structural elements

##TagDescription 23c3de37f2f9ebcb477c4a90aac6fffdDefine an independent content area of ​​the page. 15221ee8cba27fc1d7a26c47a001eb9bDefine the sidebar content of the page. af4e6c3c591431c4583becd75d1c3582Allows you to set a piece of text independent of the text direction setting of its parent element. e2b9f03cad787b9644e1f51fd23b7dacDefine a command button, such as a radio button, check box, or button4646b701c1f738fb936aa20967492bb3Used to describe the details of a document or a certain part of a document##a38fd2622755924ad24c0fc5f0b4d412631fb227578dfffda61e1fa4d04b7d25##24203f2f45e6606542ba09fd2181843a is specified independently of streaming content (images, charts, photos, code, etc.). 614eb9dc63b3fb809437a716aa228d24Define the title of the 24203f2f45e6606542ba09fd2181843a elementc37f8231a37e88427e62669260f0074dDefine the footer of section or document. 1aa9e5d373740b65a0cc8f0a02150c53 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
##f920514e6447cf1d171079d1371f007f
49c6123c49c6be380cb91db06cd3bfa9
c787b9a589a3ece771e842a6176cf8e9
6ecb87e5318a36c03c59e25d55f43372
ec41f2147470148e85ad0337a362103e
7240f116d85a7ee375466871bc33670a
515718f19dfe6612658be14be18aa0ec
2f8332c8dcfd5c7dec030a070bf652c3
46dd80ba616c57a652514755c74c4211
37fcc81822f151c26d66e5caf9953670

html5 tag usage example

(1) Define navigation linkc787b9a589a3ece771e842a6176cf8e944f9630a3d507ae7532760da37622b0f

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 dfcf8451c675c9fc96ca7315f35b831925edfb22a4f469ecb59f1190150159c6 tags

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 23c3de37f2f9ebcb477c4a90aac6fffd7618f95bdc39e398f223d37049478af1

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 4a249f0d628e2318394fd9b75b4636b1e388a4556c0f65e1904146cc1a846bee

html code:

<article><!--文章块p-->
  <h2>文章标题</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 titles24203f2f45e6606542ba09fd2181843a

A. This tag can be used in conjunction with its matching tag 614eb9dc63b3fb809437a716aa228d24, but the title

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

B must be written in the middle of 614eb9dc63b3fb809437a716aa228d24c03477f35900935b9be6780eb373f61c. It can also be used in combination with 73de882deff7a050a357292d0a1fca9467bc4f89d416b0b8236eaa5f43dee742, where 73de882deff7a050a357292d0a1fca94c72c1af5e0e7f90179c047c5ef85885e is used to write the title, while 67bc4f89d416b0b8236eaa5f43dee742 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 windowa38fd2622755924ad24c0fc5f0b4d412

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 commands5c0e96d12fc7501cef2ae2efde646ee0

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) 5741137ab4b51d65ce4bf01eaefd4654 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 groupd8eccd9ed644b68a6460a2bb84548c82

You can write some combinations of titles684271ed9684bde649abda8831d4d355for common use

<hgroup><!--标题组-->
        <h3>标题</h3>
        <h3>标题1</h3>
        <h3>标题2</h3>
        <h3>标题3</h3>
</hgroup>

# #(7) Define small textd015d241ae6d34c34210679b5204fe85

This tag is actually similar to other bold tags

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

(8) Define the details of the elementa5e9d42b316b6d06c62de0deffc36939

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 ec41f2147470148e85ad0337a362103e

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 range49c6123c49c6be380cb91db06cd3bfa9

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 bar6ecb87e5318a36c03c59e25d55f43372

<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