H5的语义化标签新特性应该如何使用

2020-07-26 20:10:15
这次给大家带来H5的语义化标签新特性应该如何使用,使用H5的语义化标签新特性的注意事项有哪些,下面就是实战案例,一起来看一下。

HTML5新特性

简洁的DOCTYPE:

HTML5 只有一个简单的文档类型:<!DOCTYPE html>,表示浏览器会按照标准模式解析。

简单易记的编码类型

你现在可以在meta 标签中使用”charset”:<meta charset=”utf-8″ />

脚本和链接无需type

<link rel="stylesheet" href="path/to/stylesheet.css" /><script src="path/to/script.js"></script>


更加语义化的新增标签

比如说:<article>、<section>、<aside>、<hgroup>、 <header>,<footer>、<nav>、<time>、<mark>、<figure> 和<figcaption>等

<video width="640" height="320" preload="auto" poster="0.jpg" controls>    <source src="movie.ogg" type="video/ogg" />    <source src="movie.mp4" type="video/mp4" />    Your browser does not support the video tag.</video>

表单增强

新的input类型:

color, email, date, month, week, time, datetime, datetime-local, number,range,search, tel, 和url

新属性:

required, autofocus, pattern, list, autocomplete 和placeholder

新元素:<keygen>, <datalist>, <output>, <meter> 和<progress>

canvas标签绘制2D图形。

var canvas = document.getElementById('canvas');var context = canvas.getContext('2d');context.beginPath();context.moveTo(100,100);context.lineTo(300,300);context.lineTo(100,500);context.lineWidth = 5;context.strokeStyle = "red";context.stroke();

相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

相关阅读:

有关HTML5页面在iPhoneX适配问题

html 表格太宽溢出父容器的解决方法

如何用html的title属性实现鼠标悬停显示文字

HTML的cellpadding属性与cellspacing属性应该如何使用