search
HomeheadlinesUnderstand HTML5 in 20 minutes and see what new features H5 has

What is HTML?

HTML (Hyper Text Mark-up Language). Hypertext Markup Language. HTML text is descriptive text composed of HTML commands. HTML commands can describe text, graphics, animations, sounds, tables, links, etc. The structure of HTML includes two parts: Head and Body. The head describes the information required by the browser, and the body contains the specific content to be explained. (HTML Video Tutorial)

What is HTML5?

The so-called effect that HTML5 can achieve is not an isolated upgraded version of HTML, but the combined performance of HTML+CSS3+JS. HTML is just a markup language, but it has been more semantically optimized, added some tags that are considered more scientific, and removed some tags, but tags are tags, and behaviors are behaviors. There is no CSS3, no JS, and HTML is not It's always just HTML. (html5 video tutorial)

Simply put, HTML5 is more semantic and standardized than the tags of previous HTML versions, and some new tags have been added. Please look at the picture below:

Understand HTML5 in 20 minutes and see what new features H5 has

#This is the HTML form of the previous web page. The new HTML looks like this:

Understand HTML5 in 20 minutes and see what new features H5 has

## Obviously, HTML5 is no longer dominated by DIV as before, and new semantic tags have been added. It may make teamwork easier for front-end engineers because there is a unified new standard.

Let’s put it into perspective, it’s a department store warehouse. The administrator Lao Wang came to clean up the warehouse, put all kinds of clothing, shoes, and department stores into different boxes, put labels on the boxes and write his name. Think of a suitable name. We can understand those boxes as DIVs, and the names on the labels are class and ID.

Okay, here comes the question. Lao Wang came home from work, and Lao Li came to take over. Lao Li started to curse after seeing what Lao Wang was doing, because he couldn't understand the labels Lao Wang wrote on the boxes, which made him have to open each box one by one to look at it. What exactly is inside? This greatly reduces work efficiency.

Understand HTML5 in 20 minutes and see what new features H5 has

The current HTML5 is to directly hand over the marked boxes to Lao Wang. He can put different clothes, hats and shoes according to different boxes, so that when Lao Zhang It will be much more convenient when I come to take over my shift. And more than that, HTML5 provides more tags so that Lao Zhang and Lao Wang can independently complete some previously complex work without having to trouble other colleagues.

Understand HTML5 in 20 minutes and see what new features H5 has

#What exactly does html5 have?

More semantic tags (developers can be more elegant and browsers can understand better)

Search engine search, why does it search for the title and not the "Introduction" ? This is because of the difference in structure. However, everyone's class naming habits of the structure will be different, and it cannot be standardized, so it is better to create new tags.

In some lower version browsers, the h5 tag is incompatible and will be considered p, which will not affect our functions. You can also add a new line of code document.createElement("header") in the script, but as many tags are used, you need to write as many lines of document.createElement(""), so there is a third-party plug-in html5shiv.js

Usage:

<!--[if lt IE 9]><script type="text/javascript"  src="http://www.ijquery.cn/js/html5shiv.js"></script><![endif]-->

Note: The Html5.js file called in the page must be added within the head element of the page, because the IE browser must know this before the element is parsed. element, so this js file cannot be called at the bottom of the page.

Application Tag

DataList

progress

Attributes

Link Relationship Describe

What is the relationship between the place linked to and the current document?

<a href="01-sementic-tags.html" rel="pre"></a><a href="02-application-tags.html" rel="next"></a>

rel also appears in other places,

<link rel="stylesheet" href="css.css">

link itself will not request the file, but rel= "stylesheet" will only request the file

It is not popular in China at the moment

Structure data tag

<p itemscope itemtype="www.baidu.com">        <p itemprop="主人">主人</p>
        <p itemprop="小狗">小狗一</p>
        <p itemprop="小狗">小狗二</p>    </p>

can facilitate search engines to focus on crawling

Very advanced, but only google supports it

ARIA

Accessible Rich Internet Application

<label for="myinput">请输入您的名字</label>
<input type="text" id="myinput">

Why does it have to be labeled for above?

is for the understanding of search engines

Custom attributes

That is, attributes such as data-*, they have no functionality, they are just for Save strongly related data of dom nodes.

<ul id="list"></ul>
    <p id="info"></p>
    <script>        var data={            01:{
                name:"张三",
                age:18
            },            02:{
                name:"李四",
                age:19
            },            03:{
                name:"王五",
                age:20
            }
        };        for (var X in data) {            var item=data[X];            var oli=document.createElement("li");            var olist=document.getElementById("list");
            oli.appendChild(document.createTextNode(item.name));
            olist.appendChild(oli);
            oli.setAttribute("data-name",item.name);
            oli.setAttribute("data-age",item.age );
            oli.addEventListener("click", function () {                var name=this.getAttribute("data-name");                var age=this.getAttribute("data-age");
                alert(age+name)
            })
        }
    </script>

上面的代码用 setattribue 方法来定义了自定义属性,然后用getattribute又获取到了自定义属性。js也针对自定义属性出了新的api,也就是 dataset['string'] ,使用这个api可以代替 getAttribute 的方法:

oli.addEventListener("click",function(){    console.log(this.dataset["name"]);
})

智能表单

新的表单类型

<input type="date">
<input type="color">
<input type="range">

但是尽量不要在pc端使用,用户体验较差,不能自定义样式。主要适配在移动端。

虚拟键盘适配

<input type="text" name="txt_text" id="txt_text">
<input type="number" name="txt_number" id="txt_number">
<input type="email" name="txt_email" id="txt_email">
<input type="tel" name="txt_tel" id="txt_tel">
<input type="url" name="txt_url" id="txt_url">

上面的代码在pc端上没有用处,主要是用在移动端可以根据不同的input的 type 来唤出不同的键盘。

虽然 input type="email" 看似可以验证表单,但是真是太弱了,只是验证有没有 @ ,真的要验证的话,还是要自己写正则表达式

页面多媒体

音频

<audio src="A Moment of Reflection.mp3" controls="controls"></audio>

但是默认的播放器太丑了,我们一般是自己写一个button,然后为这个button添加一个事件:

<script>        var btn=document.getElementById("btn");        var btn1=document.getElementById("btn1");        var audio=document.getElementsByTagName("audio")[0];
        btn.addEventListener("click", function () {
            audio.play();
        })
        btn1.addEventListener("click",function (argument) {
            audio.pause();
        })
</script>

视频

<video src="A Moment of Reflection.mp4" controls="controls"></video>

但是我们一般不是这样用的,因为视频有版权,有些浏览器只能支持一两个,我们一般是source:

<video controls="controls"><source src="下午03-网页多媒体.web.mp4"><source src="下午03-网页多媒体.web.ogg"><p>您的浏览器不支持</p></video>

还有一个插件,是可以帮我们做兼容的,是html5media.info/的组件,ie7以上都可以兼容。

以下是多媒体的属性;

[image_1b2cut34s130mfufars1a6m6va9.png-66.1kB][1]

字幕

兼容性不是很好,现在还没有人用

canvas

2d

3d

svg

优势:体积小,质量高,效果好,可控程度高。

相关推荐:

成为一名优秀的前端工程师需要学什么?

web前端学习路线:WEB前端开发快速入门

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
html5的div一行可以放两个吗html5的div一行可以放两个吗Apr 25, 2022 pm 05:32 PM

html5的div元素默认一行不可以放两个。div是一个块级元素,一个元素会独占一行,两个div默认无法在同一行显示;但可以通过给div元素添加“display:inline;”样式,将其转为行内元素,就可以实现多个div在同一行显示了。

html5中列表和表格的区别是什么html5中列表和表格的区别是什么Apr 28, 2022 pm 01:58 PM

html5中列表和表格的区别:1、表格主要是用于显示数据的,而列表主要是用于给数据进行布局;2、表格是使用table标签配合tr、td、th等标签进行定义的,列表是利用li标签配合ol、ul等标签进行定义的。

html5怎么让头和尾固定不动html5怎么让头和尾固定不动Apr 25, 2022 pm 02:30 PM

固定方法:1、使用header标签定义文档头部内容,并添加“position:fixed;top:0;”样式让其固定不动;2、使用footer标签定义尾部内容,并添加“position: fixed;bottom: 0;”样式让其固定不动。

HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

html5中不支持的标签有哪些html5中不支持的标签有哪些Mar 17, 2022 pm 05:43 PM

html5中不支持的标签有:1、acronym,用于定义首字母缩写,可用abbr替代;2、basefont,可利用css样式替代;3、applet,可用object替代;4、dir,定义目录列表,可用ul替代;5、big,定义大号文本等等。

html5废弃了哪个列表标签html5废弃了哪个列表标签Jun 01, 2022 pm 06:32 PM

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

html5是什么意思html5是什么意思Apr 26, 2021 pm 03:02 PM

html5是指超文本标记语言(HTML)的第五次重大修改,即第5代HTML。HTML5是Web中核心语言HTML的规范,用户使用任何手段进行网页浏览时看到的内容原本都是HTML格式的,在浏览器中通过一些技术处理将其转换成为了可识别的信息。HTML5由不同的技术构成,其在互联网中得到了非常广泛的应用,提供更多增强网络应用的标准机。

Html5怎么取消td边框Html5怎么取消td边框May 18, 2022 pm 06:57 PM

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。

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)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment