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();
相信看了这些案例你已经掌握了方法,更多精彩请关注编程之家网其它相关文章!
相关阅读: