日期:2014-05-17  浏览次数:20657 次

Five Things You Should Know About HTML5(HTML5,你需要知道的5件事)
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应用了