Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (57 sloc) 8.62 KB
<!DOCTYPE html>
<meta charset=utf-8>
<title>Five Things You Should Know About HTML5 - Dive Into HTML5</title>
<!--[if lt IE 9]><script src=j/html5.js></script><![endif]-->
<link rel=alternate type=application/atom+xml href=>
<link rel=stylesheet href=screen.css>
<link rel=stylesheet media='only screen and (max-device-width: 480px)' href=mobile.css>
<link rel=prefetch href=past.html>
<p>You are here: <a href=index.html>Home</a> <span class=u>&#8227;</span> <a href=table-of-contents.html#introduction>Dive Into <abbr>HTML5</abbr></a> <span class=u>&#8227;</span>
<h1><br>Five Things You Should Know About HTML5</h1>
<p id=toc>&nbsp;
<p class=a>&#x2767;
<h2 id=one>1. It&#8217;s not one big thing</h2>
<p style="float:right;margin:0 0 1.75em 1.75em"><img src=i/video.png alt="[mock video player]" width=226 height=166>
<p>You may well ask: &#8220;How can I start using <abbr>HTML5</abbr> if older browsers don&#8217;t support it?&#8221; But the question itself is misleading. <abbr>HTML5</abbr> is not one big thing; it is a collection of individual features. So you can&#8217;t detect &#8220;<abbr>HTML5</abbr> support,&#8221; because that doesn&#8217;t make any sense. But you <em>can</em> detect support for individual features, like canvas, video, or geolocation.
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&#8217;s an important part of it, but it&#8217;s not the whole story. The <abbr>HTML5</abbr> specification also defines how those angle brackets interact with JavaScript, through the Document Object Model (<abbr>DOM</abbr>). <abbr>HTML5</abbr> doesn&#8217;t just define a <code>&lt;video></code> tag; there is also a corresponding <abbr>DOM</abbr> <abbr>API</abbr> for video objects in the <abbr>DOM</abbr>. You can use this <abbr>API</abbr> 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 <code>&lt;video></code> tag itself.
<p><a href=detect.html>Chapter 2</a> and <a href=everything.html>Appendix A</a> will teach you how to properly detect support for each new <abbr>HTML5</abbr> feature.
<h2 id=two>2. You don&#8217;t need to throw anything away</h2>
<p style="float:left;margin:0 1.75em 1.75em 0"><img src=i/forms.png alt="[sample form controls]" width=134 height=196>
<p>Love it or hate it, you can&#8217;t deny that <abbr>HTML</abbr> 4 is the most successful markup format ever. <abbr>HTML5</abbr> builds on that success. You don&#8217;t need to throw away your existing markup. You don&#8217;t need to relearn things you already know. If your web application worked yesterday in <abbr>HTML</abbr> 4, it will still work today in <abbr>HTML5</abbr>. Period.
<p>Now, if you want to <em>improve</em> your web applications, you&#8217;ve come to the right place. Here&#8217;s a concrete example: <abbr>HTML5</abbr> supports all the form controls from <abbr>HTML</abbr> 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 <code>email</code> 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&#8217;t support the <code>email</code> 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 <em>today</em>, even if some of your visitors are stuck on IE 6.
<p>Read all the gory details about <abbr>HTML5</abbr> forms in <a href=forms.html>Chapter 9</a>.
<h2 id=three>3. It&#8217;s easy to get started</h2>
<p style="float:right;margin:0 0 1.75em 1.75em"><img src=i/markup-with-arrow.png alt="[sample HTML markup]" width=234 height=202>
<p>&#8220;Upgrading&#8221; to <abbr>HTML5</abbr> can be as simple as changing your <i>doctype</i>. The doctype should already be on the first line of every <abbr>HTML</abbr> page. Previous versions of <abbr>HTML</abbr> defined a lot of doctypes, and choosing the right one could be tricky. In <abbr>HTML5</abbr>, there is only one doctype:
<p><code>&lt;!DOCTYPE html></code>
<p>Upgrading to the <abbr>HTML5</abbr> doctype won&#8217;t break your existing markup, because <a rel=external href= target=_blank>obsolete elements</a> previously defined in HTML 4 will still render in <abbr>HTML5</abbr>. But it will allow you to use &mdash; and validate &mdash; new semantic elements like <code>&lt;article></code>, <code>&lt;section></code>, <code>&lt;header></code>, and <code>&lt;footer></code>. You&#8217;ll learn all about these new elements in <a href=semantics.html>Chapter 3</a>.
<h2 id=four>4. It already works</h2>
<p style="float:left;margin:0 1.75em 1.75em 0"><img src=i/rel-email.png alt="[form field with onscreen keyboard]" width=227 height=192>
<p>Whether you want to draw on a canvas, play video, design better forms, or build web applications that work offline, you&#8217;ll find that <abbr>HTML5</abbr> is already well-supported. Firefox, Safari, Chrome, Opera, and mobile browsers already support canvas (<a href=canvas.html>Chapter 4</a>), video (<a href=video.html>Chapter 5</a>), geolocation (<a href=geolocation.html>Chapter 6</a>), local storage (<a href=storage.html>Chapter 7</a>), and more. Google already supports microdata annotations (<a href=extensibility.html>Chapter 10</a>). Even Microsoft &mdash; rarely known for blazing the trail of standards support &mdash; supports most <abbr>HTML5</abbr> features in Internet Explorer 9.
<p style="float:right;margin:0 0 1.75em 1.75em"><img src=i/gears.png alt="[Gears saying &quot;I can help&quot;]" width=125 height=75>
<p>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. <abbr>HTML5</abbr> features like geolocation (<a href=geolocation.html>Chapter 6</a>) and video (<a href=video.html>Chapter 5</a>) were first provided by browser plugins like Gears or Flash. Other features, like canvas (<a href=canvas.html>Chapter 4</a>), 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.
<h2 id=five>5. It&#8217;s here to stay</h2>
<p>Tim Berners-Lee invented the world wide web in the early 1990s. He later founded the <abbr>W3C</abbr> to act as a steward of web standards, which the organization has done for more than 15 years. Here is what the <abbr>W3C</abbr> had to say about the future of web standards, in July 2009:
<blockquote cite=>
<p>Today the Director announces that when the <abbr>XHTML</abbr> 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 <abbr>HTML</abbr> Working Group, <abbr>W3C</abbr> hopes to accelerate the progress of <abbr>HTML5</abbr> and clarify <abbr>W3C</abbr>&#8217;s position regarding the future of <abbr>HTML</abbr>.
<p><abbr>HTML5</abbr> is here to stay. <a href=past.html>Let&#8217;s dive in</a>.
<p class=a>&#x2767;
<div class=pf>
<h4>Did You Know?</h4>
<div class=moneybags>
<blockquote><p>In association with Google Press, O&#8217;Reilly is distributing this book in a variety of formats, including paper, ePub, Mobi, and <abbr>DRM</abbr>-free <abbr>PDF</abbr>. The paid edition is called &#8220;HTML5: Up &amp; Running,&#8221; and it is available now.
<p>If you liked this introduction and want to show your appreciation, you can <a href=";tag=diveintomark-20&amp;creativeASIN=0596806027">buy &#8220;HTML5: Up &amp; Running&#8221; with this affiliate link</a> or <a href=>buy an electronic edition directly from O&#8217;Reilly</a>. You&#8217;ll get a book, and I&#8217;ll get a buck. I do not currently accept direct donations.
<p class=c>Copyright MMIX&ndash;MMXI <a href=about.html>Mark Pilgrim</a>
<form action=><div><input type=hidden name=cx value=017884302975346027366:bgclqh8nvse><input type=hidden name=ie value=UTF-8><input type=search name=q size=25 placeholder="powered by Google&trade;">&nbsp;<input type=submit name=sa value=Search></div></form>
<script src=j/jquery.js></script>
<script src=j/dih5.js></script>