Important Concepts for HTML5
The Goals of HTML5
HTML5 was born out of visible needs in the browser ecosystem, and the aims of its specifications are all responses to these needs. This section details the three most prominent goals of HTML5, which can be thought of as themes that you see throughout the book.
Improving the Native Web
According to the World Wide Web Consortium (W3C) specification, HTML5 “introduces markup and APIs for emerging idioms, such as Web applications.” More specifically, HMTL5 adds syntactic features to the Web that could previously only be accomplished with plug-ins. For instance, if serving video on the Web is a nearly ubiquitous expectation, web browsers ought to be able to accomplish it without additional help. The same goes for audio and other animated or dynamic content. Thus the <audio>, <video>, and <canvas> elements are some of HTML5’s most important additions to the Web.
HTML5 doesn’t just make plug-ins less necessary, it also increases the browser’s functionality to be more in line with native mobile applications. Browser vendors and standards committees have begun work on application programming interfaces (APIs) that expose functionality of (mobile) devices within the browser. The most prominent example of this is the Geolocation API, which allows browsers to retrieve geographical location much like native phone apps do. There are several smaller niche APIs (such as one for device orientation) that also promise to afford more utility in the browser.
More Done with Less Code
One much more subtle feature of HTML5 is the ability to do more with less code. There are a lot of de facto standard web page features, such as placeholder text in forms, autofocusing on a particular input element once the page loads, client-side validation of form input, date and time pickers, and so on.
All of these concepts are considered standard-issue stuff on a modern web page, but every one of them requires at least a little bit of JavaScript to work. Because of this, these concepts are implemented across websites in many different ways, and are at times buggy or inconsistent with each other.
HTML5 simplifies these common design patterns (and more) by creating standardized ways to accomplish them in HTML alone. This empowers designers and also reduces code maintenance and interoperability between platforms because the given feature’s functionality can be more contextually handled by the browser.
The Semantic Web
The semantic web is a long-held dream of the Web’s inventor, Tim Berners-Lee. He envisioned a web where content was not only readable by humans but also understood by machines. Just as we have to write carefully for humans to comprehend, it would also take a little footwork to make sure programs parsing web pages could pick up on meaningful content.
HTML5 represents the first big semantic push on the Web, and there are important semantic components discussed in Chapters 3 and 13 (“Getting Started with HTML5: Semantic Tags, Forms, and Drag and Drop” and “Microdata, Other Small Things, and Beyond HTML5,” respectively). Now web pages can be marked up to be better understood and categorized by screen readers, search engines, and other web-crawling software. Chapter 13 also contains a brief history of web semantics and their current utility.