Skip to content

Instantly share code, notes, and snippets.

@jskopek
Created October 26, 2018 18:55
Show Gist options
  • Save jskopek/4e886bb9a99873fca11b74db33bc79e0 to your computer and use it in GitHub Desktop.
Save jskopek/4e886bb9a99873fca11b74db33bc79e0 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base href="https://docraptor.com/">
<title>Five Things You Should Know About HTML5 - Dive Into HTML5</title>
<link rel="stylesheet" href="/samples/diveintohtml5.screen.css">
<style>
h1:before {
content: "Introduction:"
}
h2 {
text-align: left;
text-transform: inherit
}
@page {
margin-top: 20px;
@top {
/* header with counter functions to insert page counters */
content: "Page " counter(page) " of " counter(pages) " pages "
}
}
#toc li a::after {content: " | Page " target-counter(attr(href), page);}
</style>
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="/samples/diveintohtml5.mobile.css">
</head>
<body>
<h1>Testing</h1>
<div id="toc">
<h3>Table of Contents</h3>
<ul>
<li><a href="#one">One</a></li>
<li><a href="#two">Two</a></li>
<li><a href="#three">Three</a></li>
<li><a href="#four">Four</a></li>
</ul>
</div>
<p>You are here: <a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/index.html">Home</a>
<span class="u triangularBullet"></span> <a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/table-of-contents.html#introduction">Dive
Into <abbr>HTML5</abbr></a> <span class="u triangularBullet"></span>
<h1><br>Five Things You Should Know About HTML5</h1>
<p id="toc">&nbsp;
<p class="a rotatedFloralHeartBullet">
<h2 id="one">1. It&rsquo;s not one big thing</h2>
</p>
<p style="float:right;margin:0 0 1.75em 1.75em"><img src="http://diveintohtml5.info/i/video.png" alt="[mock video player]"
width="226" height="166"></p>
<p>You may well ask: &ldquo;How can I start using <abbr>HTML5</abbr> if older browsers don&rsquo;t support
it?&rdquo; But the question itself is misleading. <abbr>HTML5</abbr> is not one big thing; it is a
collection of individual features. So you can&rsquo;t detect &ldquo;<abbr>HTML5</abbr> support,&rdquo;
because that doesn&rsquo;t make any sense. But you <em>can</em> detect support for individual features,
like canvas, video, or geolocation.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p>You may think of <abbr>HTML</abbr> as tags and angle brackets. That&rsquo;s an important part of it, but
it&rsquo;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&rsquo;t just define a <code>&lt;video&gt;</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&gt;</code>
tag itself.</p>
<p><a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/detect.html">Chapter 2</a>
and <a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/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&rsquo;t need to throw anything away</h2>
<p style="float:left;margin:0 1.75em 1.75em 0"><img src="http://diveintohtml5.info/i/forms.png" alt="[sample form controls]"
width="134" height="196">
<p>Love it or hate it, you can&rsquo;t deny that <abbr>HTML</abbr> 4 is the most successful markup
format ever. <abbr>HTML5</abbr> builds on that success. You don&rsquo;t need to throw away your
existing markup. You don&rsquo;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&rsquo;ve come to the right
place. Here&rsquo;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&rsquo;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="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/forms.html">Chapter
9</a>.
<h2 id="three">3. It&rsquo;s easy to get started</h2>
<p style="float:right;margin:0 0 1.75em 1.75em"><img src="http://diveintohtml5.info/i/markup-with-arrow.png"
alt="[sample HTML markup]" width="234" height="202">
<p>&ldquo;Upgrading&rdquo; 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:
<blockquote>
<p><code>&lt;!DOCTYPE html&gt;</code>
</blockquote>
<p>Upgrading to the <abbr>HTML5</abbr> doctype won&rsquo;t break your existing
markup, because <a rel="external" href="http://www.w3.org/TR/html5-diff/#absent-elements"
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&gt;</code>,
<code>&lt;section&gt;</code>, <code>&lt;header&gt;</code>, and <code>&lt;footer&gt;</code>.
You&rsquo;ll learn all about these new elements in <a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/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="http://diveintohtml5.info/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&rsquo;ll
find that <abbr>HTML5</abbr> is already well-supported. Firefox,
Safari, Chrome, Opera, and mobile browsers already support canvas (<a
href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/canvas.html">Chapter
4</a>), video (<a href="http://diveintohtml5.info/video.html">Chapter
5</a>), geolocation (<a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/geolocation.html">Chapter
6</a>), local storage (<a href="http://diveintohtml5.info/storage.html">Chapter
7</a>), and more. Google already supports microdata annotations
(<a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/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="http://diveintohtml5.info/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="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/geolocation.html">Chapter
6</a>) and video (<a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/video.html">Chapter
5</a>) were first provided by browser plugins like
Gears or Flash. Other features, like canvas (<a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/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&rsquo;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="http://www.w3.org/News/2009#item119">
<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>&rsquo;s position regarding the
future of <abbr>HTML</abbr>.
</blockquote>
<p><abbr>HTML5</abbr> is here to stay. <a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/past.html">Let&rsquo;s
dive in</a>.
<p class="a rotatedFloralHeartBullet">
<div class="pf">
<h4>Did You Know?</h4>
<div class="moneybags">
<blockquote>
<p>In association with Google
Press, O&rsquo;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 &ldquo;HTML5:
Up &amp; Running,&rdquo; and it
is available now.
<p>If you liked this
introduction and want to
show your appreciation, you
can <a href="http://diveintohtml5.info/http://www.amazon.com/HTML5-Up-Running-Mark-Pilgrim/dp/0596806027?ie=UTF8&amp;tag=diveintomark-20&amp;creativeASIN=0596806027">buy
&ldquo;HTML5: Up &amp;
Running&rdquo; with
this affiliate link</a>
or <a href="http://diveintohtml5.info/http://oreilly.com/catalog/9780596806033">buy
an electronic edition
directly from
O&rsquo;Reilly</a>.
You&rsquo;ll get a book,
and I&rsquo;ll get a buck.
I do not currently accept
direct donations.
</blockquote>
</div>
</div>
<p class="c">Copyright MMIX&ndash;MMXI <a href="https://web.archive.org/web/20170614100030/http://diveintohtml5.info/about.html">Mark
Pilgrim</a></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment