html5简介_HTML5简介

html5简介

htmlcss2thumb

The following is an extract from our book, HTML5 & CSS3 for the Real World, 2nd Edition, written by Alexis Goldstein, Louis Lazaris, and Estelle Weyl. Copies are sold in stores worldwide, or you can buy it in ebook form here.

以下摘自Alexis Goldstein,Louis Lazaris和Estelle Weyl编写的《现实世界HTML5和CSS3,第二版 》一书。 副本在世界各地的商店中都有出售,或者您可以在此处以电子书形式购买

What we understand today as HTML5 has had a relatively turbulent history. You probably already know that HTML is the predominant markup language used to describe content, or data, on the World Wide Web (another lesser-used markup language is XML). HTML5 is the latest iteration of the HTML5 language and includes new features, improvements to existing features, and JavaScript APIs.

我们今天对HTML5的了解已有一段相对动荡的历史。 您可能已经知道HTML是用于描述万维网上的内容或数据的主要标记语言(另一种较少使用的标记语言是XML)。 HTML5是HTML5语言的最新版本,包括新功能,对现有功能的改进以及JavaScript API。

That said, HTML5 is not a reformulation of previous versions of the language—it includes all valid elements from both HTML4 and XHTML 1.0. Furthermore, it’s been designed with some principles in mind to ensure it works on just about every platform, is compatible with older browsers, and handles errors gracefully. A summary of the design principles that guided the creation of HTML5 can be found on the W3C’s HTML Design Principles page.

也就是说,HTML5并不是该语言先前版本的重新表述-它包括HTML4和XHTML 1.0的所有有效元素。 此外,它在设计时考虑了一些原则,以确保它可以在几乎所有平台上运行,与较旧的浏览器兼容并可以优雅地处理错误。 可以在W3CHTML设计原则页面上找到指导创建HTML5 的设计原则的摘要。

First and foremost, HTML5 includes redefinitions of existing markup elements in addition to new elements that allow web designers to be more expressive in describing the content of their pages. Why litter your page with div elements when you can use article, section, header, footer, and so on?

首先,HTML5除包含使Web设计人员在描述其页面内容时更具表现力的新元素外,还包括对现有标记元素的重新定义。 当可以使用articlesectionheaderfooter ,为什么还要用div元素填充页面?

The term “HTML5” has also been used to refer to a number of other new technologies and APIs. Some of these include drawing with the canvas element, offline storage, the new video and audio elements, drag-and-drop functionality, Microdata, and embedded fonts. In this book, we’ll be covering a number of those technologies, and more.

术语“ HTML5”也已用于指代许多其他新技术和API。 其中一些功能包括使用canvas元素绘制,离线存储,新的videoaudio元素,拖放功能,Microdata和嵌入式字体。 在本书中,我们将介绍许多这些技术,以及更多。

注意:应用程序编程接口 (Note: Application Programming Interface)

API stands for Application Programming Interface. Think of an API in the same way you think of a graphical user interface or GUI—except that instead of being an interface for humans, it’s an interface for your code. An API provides your code with a set of “buttons” (predefined methods) that it can press to elicit the desired behavior from the system, software library, or browser.

API代表应用程序编程接口。 考虑API的方式与考虑图形用户界面或GUI的方式相同,不同之处在于,API并不是人类的接口,而是代码的接口。 API为您的代码提供了一组“按钮”(预定义的方法),可以按这些按钮来从系统,软件库或浏览器中引发所需的行为。

API-based commands are a way of abstracting the more complex workings that are done in the background (or sometimes by third-party software). Some of the HTML5-related APIs will be introduced and discussed in later sections of this book.

基于API的命令是抽象化在后台(或有时通过第三方软件)完成的更复杂工作的一种方式。 本书稍后的部分将介绍和讨论一些与HTML5相关的API。

Overall, you shouldn’t be intimidated if you’ve had little experience with JavaScript or other APIs. While it would certainly be beneficial to have some experience with JavaScript or other languages, it isn’t mandatory. Whatever the case, we’ll walk you through the scripting parts of our book gradually, ensuring that you’re not left scratching your head!

总体而言,如果您对JavaScript或其他API的使用经验很少,则不要害怕。 拥有JavaScript或其他语言的经验当然会有所帮助,但这不是强制性的。 无论如何,我们都会逐步引导您完成本书的脚本编制部分,以确保您不会被挠头!

At the time of writing, it’s been a good 5-plus years since HTML5 has had wide use in terms of the semantic elements and the various APIs. So it’s no longer correct to categorize HTML5 as a “new” set of technologies—but it is still maturing and there are ongoing issues that continue to be addressed (such as bugs in browsers, and inconsistent support across browsers and platforms).

在撰写本文时,距HTML5在语义元素和各种API方面的广泛使用已经过去了5年多。 因此,将HTML5归类为“新”技术集不再是正确的做法-但它仍在日趋成熟,并且仍在解决持续存在的问题(例如浏览器中的错误以及跨浏览器和平台的不一致支持)。

It should also be noted that some technologies were never part of HTML5 (such as CSS3 and WOFF), yet have at times been lumped in under the same label. This has instigated the use of broad, all-encompassing expressions such as “HTML5 and related technologies.” In the interest of brevity—and also at the risk of inciting heated arguments—we’ll generally refer to these technologies collectively as “HTML5.”

还应该注意的是,某些技术从来都不是HTML5的一部分(例如CSS3和WOFF),但有时却被归入同一标签之下。 这促使人们使用了广泛而广泛的表达方式,例如“ HTML5和相关技术”。 为了简洁起见,并且冒着引起激烈争论的风险,我们通常将这些技术统称为“ HTML5”。

我们是怎么来到这里的? (How did we get here?)

The web development industry has evolved significantly in a relatively short time period. In the late 1990s, a website that included images and an eye-catching design was considered top of the line in terms of web content and presentation.

Web开发行业在相对较短的时间内已经取得了长足的发展。 在1990年代后期,就网站内容和呈现而言,一个包含图像和醒目的设计的网站被认为是最重要的。

Today, the landscape is quite different. Simple performance-driven, Ajax-based websites (usually differentiated as “web apps”) that rely on client-side scripting for critical functionality are becoming more and more common. Websites today often resemble standalone software applications, and an increasing number of developers are viewing them as such.

如今,景观已大为不同。 基于性能的,基于Ajax的简单网站(通常称为“ Web应用程序”)依赖于客户端脚本来实现关键功能,这一点变得越来越普遍。 当今的网站通常类似于独立的软件应用程序,并且越来越多的开发人员正如此浏览它们。

Along the way, web markup has evolved. HTML4 eventually gave way to XHTML, which is really just HTML4 with strict XML-style syntax. HTML5 has taken over as the most-used version of markup, and we now rarely, if ever, see new projects built with HTML4 or XHTML.

在此过程中,Web标记不断发展。 HTML4最终让位给XHTML,它实际上只是具有严格XML样式语法HTML4。 HTML5已经成为标记的最常用版本,并且我们现在很少(如果有的话)看到使用HTML4或XHTML构建的新项目。

HTML5 originally began as two different specifications: Web Forms 2.0 and Web Apps 1.0. Both were a result of the changed web landscape and the need for faster and more efficient maintainable web applications. Forms and app-like functionality are at the heart of web apps, so this was the natural direction for the HTML5 spec to take. Eventually, the two specs were merged to form what we now call HTML5.

HTML5最初是从两个不同的规范开始的: Web Forms 2.0Web Apps 1.0。 两者都是网络格局变化以及对更快,更高效的可维护Web应用程序的需求的结果。 表单和类似应用的功能是Web应用的核心,因此这是HTML5规范采用的自然方向。 最终,这两个规范被合并以形成我们现在称为HTML5的格式。

For a short time, there was discussion about the production of XHTML 2.0, but that project has long since been abandoned to allow focus on the much more practical HTML5.

在很短的时间内,对XHTML 2.0的生产进行了讨论但是该项目早就被放弃了,以便专注于实用得多HTML5。

真正HTML5是否可以站起来? (Would the real HTML5 please stand up?)

Because the HTML5 specification is being developed by two different bodies (the WHATWG and the W3C), there are two versions of the spec. The W3C (or World Wide Web Consortium) you’re probably familiar with: it’s the organization that maintains the original HTML and CSS specifications, as well as a host of other web-related standards such as SVG (Scalable Vector Graphics) and WCAG (Web Content Accessibility Guidelines).

因为HTML5规范是由两个不同的机构(WHATWG和W3C)开发的,所以该规范有两个版本。 您可能熟悉的W3C(或万维网联盟):它是维护原始HTML和CSS规范的组织,以及许多其他与Web相关的标准,例如SVG(可缩放矢量图形)和WCAG( Web内容可访问性指南)。

The WHATWG (aka the Web Hypertext Application Technology Working Group), on the other hand, was formed by a group of people from Apple, Mozilla, and Opera after a 2004 W3C meeting left them disheartened. They felt that the W3C was ignoring the needs of browser makers and users by focusing on XHTML 2.0, instead of working on a backwards-compatible HTML standard. So they went off on their own and developed the Web Apps and Web Forms specifications that we’ve discussed, which were then merged into a spec they called HTML5. On seeing this, the W3C eventually gave in and created its own HTML5 specification based on the WHATWG’s spec.

另一方面,WHATWG(又名Web超文本应用程序技术工作组)由来自Apple,Mozilla和Opera的一群人组成,他们在2004年W3C会议中感到沮丧。 他们认为W3C专注于XHTML 2.0,而不是使用向后兼容HTML标准,从而忽略了浏览器制造商和用户的需求。 因此,他们自己动手开发了我们已经讨论过的Web Apps和Web Forms规范,然后将其合并为一个称为HTML5的规范。 看到这一点,W3C最终屈服了并根据WHATWG的规范创建了自己HTML5规范。

This can seem a little confusing. Yes, there are some politics behind the scenes that we, as designers and developers, have no control over. But should it worry us that there are two versions of the spec? In short, no.

这似乎有点令人困惑。 是的,幕后存在一些政治因素,我们作为设计师和开发人员无法控制。 但是,是否让我们担心该规范有两个版本? 简而言之,没有。

The WHATWG’s version of the specification can be found at http://www.whatwg.org/html/, and in January 2011 was renamed “HTML” (dropping the “5”). It’s now called a “living standard,” meaning that it will be in constant development and will no longer be referred to using incrementing version numbers.

可以在http://www.whatwg.org/html/上找到WHATWG的规范版本,并在2011年1月将其重命名为“ HTML”(删除了“ 5”)。 现在,它被称为“生存标准” ,这意味着它将不断发展,不再使用递增版本号来引用。

The WHATWG version contains information covering HTML-only features, including what’s new in HTML5. Additionally, there are separate specifications being developed by WHATWG that cover the related technologies. These specifications include Microdata, Canvas 2D Context, Web Workers, Web Storage, and others.

WHATWG版本包含有关仅HTML功能的信息,包括HTML5中的新增功能。 此外,WHATWG正在开发涵盖相关技术的单独规范。 这些规范包括微数据,Canvas 2D上下文,Web Workers,Web Storage等。

The W3C’s version of the spec can be found at https://www.w3.org/html/wg/drafts/html/master/, and the separate specifications for the other technologies can be accessed through http://dev.w3.org/html5/.[1]

可以在https://www.w3.org/html/wg/drafts/html/master/中找到W3C的规范版本,可以通过http://dev.w3访问其他技术的单独规范。 .org / html5 / [1]

So what’s the difference between the W3C spec and that of WHATWG? Besides the name (“Living Standard” versus “HTML5.1”), the WHATWG version is a little more informal and experimental (and, some might argue, more forward-thinking). But in most places they’re identical, so either one can be used as a basis for studying new HTML5 elements and related technologies.[2]

那么W3C规范和WHATWG规范之间有什么区别? 除了名称(“生活标准”与“ HTML5.1”)之外,WHATWG版本还更具非正式性和实验性(有些人可能会认为,更具前瞻性)。 但是在大多数地方,它们是相同的,因此任何一个都可以用作研究新HTML5元素和相关技术的基础。 [2]

我为什么要关心HTML5? (Why should I care about HTML5?)

As mentioned, at the core of HTML5 are a number of new semantic elements, as well as several related technologies and APIs. These additions and changes to the language have been introduced with the goal of allowing developers to build web pages that are easier to code, use, and access.

如前所述,HTML5的核心是许多新的语义元素以及一些相关的技术和API。 引入了对语言的这些添加和更改,其目的是允许开发人员构建易于编码,使用和访问的网页。

These new semantic elements, along with other standards such as WAI-ARIA and Microdata (which we cover in Appendix B and Appendix C respectively), help to make our documents more accessible to both humans and machines—resulting in benefits for both accessibility and search engine optimization.

这些新的语义元素以及其他标准,例如WAI-ARIA和Microdata(我们分别在附录B和附录C中进行了介绍),有助于使我们的文档更易被人和机器访问,从而为可访问性和搜索带来好处引擎优化。

The semantic elements, in particular, have been designed with the dynamic Web in mind, with a particular focus on making pages more accessible and modular. We’ll go into more detail on this in later chapters.

特别是在设计语义元素时就考虑到了动态Web,并特别着重于使页面更易于访问和模块化。 在后面的章节中,我们将对此进行更详细的介绍。

Finally, the APIs associated with HTML5 help improve on a number of techniques that web developers have been using for years. Many common tasks are now simplified, putting more power in developers’ hands. Furthermore, the introduction of HTML5 audio and video means that there will be less dependence on third-party software and plugins when publishing rich media content on the Web.

最后,与HTML5关联的API有助于改进Web开发人员使用多年的许多技术。 现在简化了许多常见的任务,使开发人员可以掌握更多功能。 此外,HTML5音频和视频的引入意味着在Web上发布富媒体内容时,对第三方软件和插件的依赖将减少。

Overall, there are good reasons to start looking into HTML5’s new features and APIs, and we’ll discuss more of those reasons as we go through this book.

总体而言,有充分的理由开始研究HTML5的新功能和API,并且在阅读本书时,我们将讨论更多这些原因。



[1] Technically, the W3C’s version has now been upgraded to a new version: “HTML5.1”. For simplicity we’ll continue to refer to both versions as “HTML5”. In addition, the W3C’s website has a wiki page dedicated to something called “HTML.next“, which discusses some far-future features of HTML that we won’t cover in this book.

[1]从技术上讲,W3C的版本现已升级到新版本: “ HTML5.1” 。 为简单起见,我们将继续将这两个版本都称为“ HTML5”。 此外,W3C的网站上有一个专用于“ HTML.next ”的Wiki页面,其中讨论了我们在本书中不会涉及HTML的一些远期功能。

[2] There’s a document published by the W3C that details many of the differences between the two specs, but most of the differences aren’t very relevant or useful.

[2] W3C发布了一份文档 ,其中详细介绍了两个规范之间的许多差异,但是大多数差异不是非常相关或有用。

翻译自: https://www.sitepoint.com/introducing-html5/

html5简介

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值