学习HTML5之新特性标签一览(详细)

时间:2023-03-08 19:51:55
学习HTML5之新特性标签一览(详细)

HTML5又2008年诞生,HTML5大致可以等同于=html+css3+javascriptapi....

so --->支持css3强大的选择器和动画以及javascript的新的函数

先来记录一下HTML5增加的几个新的标签吧!

1。  <canvas>画布标签 HTML5的新标签

举例:

 <html>
<head>
<title>canvas画布的应用</title>
<p align="center">画一个矩形<span style="color : #ff0000">龚细军创作</span></p> </head>
<body>
<canvas id="can" width="400px" height="500px" style="border : 2px solid red"> </canvas>
<script type="text/javascript">
var canvas=document.getElementById("can");
var cxt = canvas.getContext("2d");
//alert(cxt);
cxt.style="#FF0000"
cxt.fillRect(10,10,30,30);
</script>
</body>
</html>

学习HTML5之新特性标签一览(详细)

2. 增加了<header> <forder>  这两个标签做到了网页和结构的分离 (使用seo 即搜索引擎)

格式:

 <html>
<header>(网页)page的头部</header>
你好呀,我是........
<footer>网页的尾部</footer>
</html>

3.增加了音频<audio>和 音频<video>两个新的标签........。

    <video src"=http://video.baomihua.com/37784322/32372832?ptag=vsogou" poster="C:\Users\Administrato\Desktop\火影Q版人物集\10.jpg"  controls="controls" width="500px" height="400px">呵呵,放不了哦!</video>
<!--嵌入一段音频-->

效果图:  (注意: 目前html所支持的格式为: mp4/ogg格式)

学习HTML5之新特性标签一览(详细)
同理,音频也是一样的...
4. 增加了离线存储功能
    学习HTML5之新特性标签一览(详细)
5. 支持语音识别   6.支持图像识别 7.支持游戏
8.支持强大的css3......(动画和选择器)
(1)
 <!DOCTYPE html>
<html>
<head>
<!--meta charset="utf-8"/-->
<title>Gxjun</title>
<!--CSS3模块-->
<style type="text/css">
div{
background-color: red;}
@-webkit-keyframes mycolor {
0%{background-color: red;}
40%{background-color: blue;}
70%{background-color: yellow;}
100%{background-color: red;}
}
div: hover{
-webkit-animation-name: mycolor;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function:linear;
}
</style>
</head> <body>
<div>hehhe</div>
</body>
</html>

以上呈现的是一个字体颜色逐渐变化的样式..

(2) css3代码选器举例:

 <html>
<head>
<style type="text/css">
p:nth-child(odd) {color:red}
</style>
</head>
<body>
<p >会是个什么颜色呢</p>
<p >会是个什么颜色呢</p>
<p >会是个什么颜色呢</p>
<p >会是个什么颜色呢</p>
</body>
</html>

效果图:

学习HTML5之新特性标签一览(详细)

6.支持拖放,跨文档,浏览器历史管理

7.各个浏览器的浏览器的兼容性很好....