Five Things You Should Know About HTML5
1. It’s not one big thing(它不是单独的大家伙)
You may well ask: “How can I start using HTML5 if older browsers don’t support it?” But the question itself is misleading. HTML5 is not one big thing; it is a collection of individual features. So you can’t detect “HTML5 support,” because that doesn’t make any sense. But you can detect support for individual features, like canvas, video, or geolocation.
你也许相当想问:”如果老版本的浏览器不支持它,我该如何开始使用HTML5?“但这个问题本身就是很容易引起误解的。HTML5不是一个单独的大家伙;它是一个由许多独立功能组成的集合。所以你不能检测出(你的浏览器)是否支持HTML5,因为那没有任何意义。但你可以检测出(你的浏览器)是否支持独立的功能,比如 canvas, video,或者 geolocation.
You may think of HTML as tags and angle brackets. That’s an important part of it, but it’s not the whole story. The HTML5 specification also defines how those angle brackets interact with JavaScript, through the Document Object Model (DOM). HTML5 doesn’t just define a <video> tag; there is also a corresponding DOM API for video objects in the DOM. You can use this API to detect support for different video formats, play a video, pause, mute audio, track how much of the video has been downloaded, and everything else you need to build a rich user experience around the <video> tag itself.
你可以将HTML想象成为一些标记或者尖括号。 这些都是它的重要组成部分, 但这些并不是全部。HTML规范也定义了这些尖括号如何通过DOM与JavaScript交互。 HTML并不仅仅定义了一个<video>标签;也包含了供video对象在DOM中使用的相应的DOM API;你能使用这些API,用于检测(浏览器)对不同格式的视频的支持,播放一个视频,暂停,静音一个音频。跟踪视频被加载的多少程度。围绕<video>标签,你可以创造出任何你想要的,拥有良好客户体验你可以将HTML想象成为一些标记或者尖括号。 这些都是它的重要组成部分, 但这些并不是全部。HTML规范也定义了这些尖括号如何通过DOM与JavaScript交互。 HTML并不仅仅定义了一个<video>标签;也包含了供video对象在DOM中使用的相应的DOM API;你能使用这些API,用于检测(浏览器)对不同格式的视频的支持,播放一个视频,暂停,静音一个音频。跟踪视频被加载的多少程度。围绕<video>标签,你可以创造出任何你想要的,拥有良好客户体验的(程序)。
2. You don’t need to throw anything away(你不需要抛弃任何东西)
Love it or hate it, you can’t deny that HTML 4 is the most successful markup format ever. HTML5 builds on that success. You don’t need to throw away your existing markup. You don’t need to relearn things you already know. If your web application worked yesterday in HTML 4, it will still work today in HTML5. Period.
不管喜欢与否, 你不能否认HTML 4是迄今为止最成功的标记语言标准。 HTML5建立于它的成功之上。你不需要抛弃任何你现有的标记。你也不需要重新学习那些你已经掌握的知识。如果你的web应用过去一直在HTML4下工作,那么现在它仍然能够在HTML5下工作。至少在一段时间内是这样。
Now, if you want to improve your web applications, you’ve come to the right place. Here’s a concrete example: HTML5 supports all the form controls from HTML 4, but it also includes new input controls. Some of these are long-overdue additions like sliders and date pickers; others are more subtle. For example, the email input type looks just like a text box, but mobile browsers will customize their onscreen keyboard to make it easier to type email addresses. Older browsers that don’t support the email input type will treat it as a regular text field, and the form still works with no markup changes or scripting hacks. This means you can start improving your web forms today, even if some of your visitors are stuck on IE 6.
现在, 如果你想要升级你的web应用,那么你来对地方了。 这里有个具体的例子: HTML5支持所有的HTML4中的窗体控件,但它也提供了一些新的input控件。其中有一些早该加入的功能,比如sliders(滚动条)和date pickers(日期选择控件);其余的(控件)则更加巧妙。 比如, email输入控件看起来更像一个text box(文本框),但是手机浏览器会根据它们的触摸屏键盘自动调整,使它更容易输入email地址。 老版本的不支持email控件的浏览器将仍然将它当做一个普通的文本框, 表单(窗体)仍然正常工作,不需要对标签或者脚本做任何更改。 这些意味着你已经可以开始升级你的web应用了,虽然你的用户可能还在使用IE 6。
3. It’s easy to get started(它非常容易上手)
“Upgrading” to HTML5 can be as simple as changing your doctype. The doctype should already be on the first line of every HTML page. Previous versions of HTML defined a lot of doctypes, and choosing the right one could be tricky. In HTML5, there is only one doctype:
<!DOCTYPE html>
升级到HTML5非常简单,简单到只需要修改你页面上的doctype。doctype应该出现在所有的HTML页面的第一行。前一个版本的HTML定义了相当多的doctype, 在它们中选择一个正确的来使用会变得非常复杂。在HTML5中,只有唯一的doctype:
<!DOCTYPE html>
Upgrading to the HTML5 doctype won’t break your existing markup, because all the tags defined in HTML 4 are still supported in HTML5. But it will allow you to use ― and validate ― new semantic elements like <article>, <section>, <header>, and <footer>.
升级到HTML5的doctype不会破坏你任何的已经存在的标记,因为在HTML 4中定义的所有标记在HTML5中同样得到了支持。但它会允许你使用一些新的语义元件比如<article>, <section>, <header>, and <footer>.
4. It already works(它已经开始工作了)
Whether you want to draw on a canvas, play video, design better forms, or build web applications that work offline, you’ll find that HTML5 is already well-supported. Firefox, Safari, Chrome, Opera, and mobile browsers already support canvas, video, geolocation, local storage, and more. Google already supports microdata annotations. Even Microsoft ― rarely known for blazing the trail of standards support ― will be supporting most HTML5 features in the upcoming Internet Explorer 9.
无论你是想在canvas上画画,播放视频,设计更好的表单,或者创建能在离线状态下工作的web应用,你会发现HTML5已经被广泛地支持了。Firefox, Safari, Chrome, Opera,以及许多手机浏览器已经支持canvas, video, geolocation(地理位置定位), local storage(本地存储), 甚至更多。 Google已经开始支持microdata annotations(microdata是HTML新定义的一个规范,网页可以利用microdata来针对网页里的特殊架构信息做描述。搜索引擎,浏览器可以对这些数据进行解读,并为用户提供更富用户体验的功能)。就连很少和标准接轨的微软,也将在IE9中支持HTML5的大部分功能。
5. It’s here to stay(他们要说的是)
Tim Berners-Lee invented the world wide web in the early 1990s. He later founded the W3C to act as a steward of web standards, which the organization has done for more than 15 years. Here is what the W3C had to say about the future of web standards, in July 2009:
Tim Berners-Lee在上世纪90年代早期发明了万维网。 在那以后,他创立了W3C组织作为web标准的领路者, 这个组织已经运转了超过十五年。 这里是W3C在2009年7月,谈到关于未来的web标准所说的一段话:
Today the Director announces that when the XHTML 2 Working Group charter expires as scheduled at the end of 2009, the charter will not be renewed. By doing so, and by increasing resources in the HTML Working Group, W3C hopes to accelerate the progress of HTML5 and clarify W3C’s position regarding the future of HTML.
今天,董事宣布XHTML 2工作组的执照如期在2009年末到期后,将不再重新更新。(这个小组在2010-12-17正式解散) 通过这种措施,并且加大对HTML工作组的资源投入力度, W3C希望能够加快HTML5的进程。同时无论HTML将来发展如何,W3C再次表明了它对HTML5的坚定立场。
原文链接:http://diveintohtml5.org/introduction.html