DiveIntoHTML5翻译(1)——介绍:关于HTML5你应该知道的五件事


FIVE THINGS YOU SHOULD KNOW ABOUT HTML5

1. It’s not one big thing

[mock video player]

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.

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.


1.HTML5不是“一件”大事

你可能会问:“如果我的就浏览器不支持,我要怎么开始使用HTML5技术呢?”不过这个问题本身就是误导性的。HTML5不是“一件”大事,它是一堆单独特性的集合。所以你没法检测“HTML5支持”,因为这毫无意义。不过你能检测对独立特性的支持,像canvas,video,geolocation 等等。

你可能会认为HTML就是一些标签和尖角括号。那确实是HTML的重要一部分,但不是全部。HTML5规范定义了尖角括号通过DOM怎样和JavaScript交互。HTML5并不仅仅是定义了一个<video>标签,同时也为DOM中的video对象定义了相应的DOM API。你可以使用这个API去检测对不同视频格式的支持,播放/暂停视频,静音,追踪视频的下载进度,和任何其他你围绕<video>构建一个丰富用户体验所需的。


2. You don’t need to throw anything away

[sample form controls]

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 HTML4, it will still work today in HTML5. Period.

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.


2.你不需要抛弃任何东西

     无论爱恨,你都无法否认HTML4是有史以来最成功的标记格式,HTML5建立在它的成功之上。你不需要抛弃你已有的标记,你也不需要重新学习那些你已知道的知识。如果你的web app之前在HTML4上运行良好,它在HTML5也不会有问题。至少是一段时间内。

现在,如果你希望提升你的web app,你来对地方了。这里有个具体的例子:HTML5支持HTML4中的所有控件,同时也提供了新的输入控件。有些是像滑动控制条和日期选择器这种拖了很久的扩展;另一些更细小的改进,像type是email的input框在PC端看上去知识一个普通的输入框,不过在移动浏览器里,它会将屏幕键盘自定义化,使其更方便输入email地址。不支持type为email的input的老浏览器还是将它作为一个普通的输入框处理,表单将仍能够工作在没有标记改变或者脚本hack的情况下。这意味着你现在就可以开始改进你的表单,哪怕你的浏览器还是IE6。


3. It’s easy to get started

[sample HTML markup]

“Upgrading” to HTML5 can be as simple as changing yourdoctype. 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>

Upgrading to the HTML5 doctype won’t break your existing markup, because obsolete elements previously defined in HTML 4 will still render inHTML5. But it will allow you to use — and validate — new semantic elements like<article><section><header>, and <footer>.

3.上手简单

“升级”到HTML5可以简单到只修改你页面的DOCTYPE一样。DOCTYPE应当存在在每个HTML页面的第一行。之前版本的HTML定义了许多种DOCTYPE,选择使用正确的那一个可能会非常麻烦。在HTML5里,只有一种DOCTYPE定义:


<!DOCTYPE html>


“升级”到HTML5的DOCTYPE不会破坏你之前的标记,被废弃的HTML4的元素仍能在HTML5中渲染。并且你能够使用并验证新的语义化的元素像<article>,<section>,<header>和<footer>等


4. It already works

[form field with onscreen keyboard]

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 — supports most HTML5 features in Internet Explorer 9.

[Gears saying "I can help"]

Each chapter of this book includes the all-too-familiar browser compatibility charts. But more importantly, each chapter includes a frank discussion of your options if you need to support older browsers.HTML5 features like geolocation  and video were first provided by browser plugins like Gears or Flash. Other features, like canvas , can be emulated entirely in JavaScript. This book will teach you how to target the native features of modern browsers, without leaving older browsers behind.

4.它已经在工作了

无论你是想在canvas上作画,播放视频,还是设计更好的表单,构建可以离线使用的web app,你都会发现HTML5已经得到了很好的支持。Firefox,Safari,Chrome,Opera以及移动端浏览器已经支持canvas,视频,地理位置,本地存储等许多特性。Google已经支持了微数据注释。甚至连微软,很少有人知道它是标准开拓者,在IE9中支持了绝大多数HTML5的特性。

这本书的每一章包含了常见的浏览器兼容表。更重要的是,如果你需要支持旧浏览器,每一章都包含了直率的选项讨论。HTML5的一些特性,像是地理位置,视频原来是由像Gears或者Flash这样的浏览器插件提供实现的。其他的一些特性,像是canvas,可以完全用JavaScript进行模拟。这本书将会教会你如何在瞄准现代浏览器特性的同时,不会将旧浏览器抛到一边。



5. It’s here to stay

Tim Berners-Lee invented the world wide web in the early 1990s. He later founded the W3Cto 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:

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.

HTML5 is here to stay. Let's dive in.

5.它就在那儿

蒂姆-伯纳斯-李在90年代早期发明了万维网,他稍后成立的W3C组织在之后的15年里扮演了互联网标准管家的角色。下面是W3C组织在2009年6月关于未来互联网标准的发言:

今天主管宣布当XHTML2工作小组的执照有效期如期到2009年底,执照将不会得到更新。因为这样,并且为了增加HTML工作小组的资源,W3C希望加速HTML5的进程并且阐明W3C对于未来HTML的立场。


HTML5就在那儿,让我们深入了解它吧!


http://diveintohtml5.info/introduction.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值