HTML 5 与 HTML 4 有何不同?
我已经看到 HTML 5 在不久的将来出现。它与已经在 Web 开发领域流行多年的 HTML 4 有何不同?
谢谢
I have seen HTML 5 coming up in near future. How does it differ from HTML 4, which has been 'in' for so many years in web development?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
HTML 5 和 HTML 4 之间的区别
并按照 W3C
Difference between HTML 5 and HTML 4
And as per W3C
考虑这些图像(来自 www.alistapart.com),页面的结构有很大不同:
HTML4
HTML5
这只是一个示例,请查看有关此主题的文章的其他评论
Consider these images (from www.alistapart.com), the structure of a page is hugely different:
HTML4
HTML5
This is just an example, take a look on other comments for articles about this subject
一般来说,主要有四个方面的变化:
语义标记,包括以下标签:
<部分>
<文章>
<标题>
<页脚>
<导航>
<旁边>
这还包括对
、和
标记以及链接的更改关系(
标记上的 rel 属性)。
改进的表单支持 - 主要是对输入类型的语义添加,以及一些巧妙的东西,例如字段自动聚焦和占位符文本。
改进的表单支持 - 主要
多媒体标签 -
、
和
。
和
旨在改进对页面中嵌入媒体的更好支持;
用于通过 JavaScript 在页面上以编程方式绘制二维位图。
对只能通过 JS 访问的 DOM 进行的更改 -
navigator.geolocation
、window.localStorage
(离线存储用户数据)、window.applicationCache(离线存储应用程序数据)、Web Workers(多线程 JavaScript,有一些注意事项)
HTML 的不同部分处于不同的规范阶段和实现 - Safari 之外对表单更改的支持很差,
标签在跨平台环境(没有多种视频格式)中基本无法使用,IE 内置了对 next 的支持这些变化都没有。
我见过的有关 HTML5 的最佳阅读地点是 Mark Pilgrim 正在编写的优秀著作,深入了解 HTML5
Broadly speaking, there are four main areas of change:
Semantic markup, including the following tags:
<section>
<article>
<header>
<footer>
<nav>
<aside>
<hgroup>
This also covers changes to the
<doctype>
,<html>
and<meta>
tags, as well as link relations (the rel attribute on an<a>
tag).Improved form support - mainly semantic additions to input types, and a few neat things like field autofocus and placeholder text.
Multimedia tags -
<video>
,<audio>
and<canvas>
.<video>
and<audio>
are intended to improved better support for embedded media in the page;<canvas>
is for programmatic two-dimensional bitmap drawing on the page through JavaScript.Changes to the DOM that are just accessible through JS -
navigator.geolocation
,window.localStorage
(storing user data offline),window.applicationCache
(storing app data offline), web workers (multithreaded JavaScript, with some caveats)Different parts of HTML are in different stages of specification and implementation - the form changes are poorly supported outside of Safari, the
<video>
tag is basically unusable in a cross-platform environment (without multiple video formats), and IE has built-in support for next to none of these changes.The best place to read up on HTML5 that I've seen is Mark Pilgrim's excellent book in progress, Dive into HTML5
W3C 的HTML 5 与 HTML 4 的差异
HTML 5 differences from HTML 4 by W3C
如果您犹豫是否要阅读一千页 HTML5 规范,请查看 本文。它将让您很好地了解 HTML5 的全部内容,并解释您现在如何使用 HTML5,因为大多数 A 级浏览器实际上都支持大多数新功能;比如新的 HTML 元素和嵌入式视频/音频。
If you are hesitant to read through a thousand pages of HTML5 specification, take a look at this article. It will give you a good overview of what HTML5 is all about, and it goes to explain how you can use HTML5 right now, since most A-grade browsers actually supports most of the new goodies; like the new HTML-elements and embedded video/audio.