<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HTML5 Doctor &#187; Attributes</title>
	<atom:link href="http://html5doctor.com/category/attributes/feed/" rel="self" type="application/rss+xml" />
	<link>http://html5doctor.com</link>
	<description>helping you implement HTML5 today</description>
	<lastBuildDate>Tue, 27 Jul 2010 14:36:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Video: the track element and webM codec</title>
		<link>http://html5doctor.com/video-the-track-element-and-webm-codec/</link>
		<comments>http://html5doctor.com/video-the-track-element-and-webm-codec/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 13:45:42 +0000</pubDate>
		<dc:creator>Bruce Lawson</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Elements]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[track]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[webm]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=2089</guid>
		<description><![CDATA[There are a couple of interesting developments in the world of HTML5 multimedia that you'll be interested in&#8212;the webM video format, and a proposed solution to HTML5 multimedia accessibility.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
			</a>
		</div><p>There are a couple of interesting developments in the world of <abbr>HTML</abbr>5 multimedia that you&#8217;ll be interested in. The first is the new <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-track-element"><code>&lt;track&gt;</code> element</a> (currently only in the WHAT-WG spec due to political stuff).</p>

<p><code>&lt;track&gt;</code> is a child of a <code>&lt;video&gt;</code> or <code>&lt;audio&gt;</code> element that links to a <b>timed track</b>, or time-based data. The kind of data is set via a <code>kind</code> attribute, which can take values of <code>subtitles</code>, <code>captions</code>, <code>descriptions</code>, <code>chapters</code> or <code>metadata</code>, depending on the type of information you&#8217;re adding to your media. These point to a source file containing timed text that the browser will expose via some kind of user interface, if the visitor requires additional data.</p>

<p>This will allow for &#8220;write once, use everywhere&#8221; accessibility; anyone linking to that file with a <code>&lt;video&gt;</code> or <code>&lt;audio&gt;</code> element that includes the element can access your information.</p>

<pre><code>&lt;track kind=captions src=blah.srt&gt;</code></pre>

<p>The file format is a new format called <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#websrt">WebSRT</a>, which competes with about <a href="http://wiki.whatwg.org/wiki/Timed_track_formats">50 other timed formats</a>, including some W3C formats (hence the omission of <code>&lt;track&gt;</code> from the W3C spec).</p><p>Added 9 July 2010: Here&#8217;s a readable <a href="http://www.delphiki.com/websrt/">overview of the SRT format</a>.</p>

<p>Given that the format itself isn&#8217;t fully specified yet, it will be a while until we see implementation in browsers. But it&#8217;s good to know that there will be an official way to add accessibility information to media. Until then, I have a <a href="http://dev.opera.com/articles/view/accessible-html5-video-with-javascripted-captions/">JavaScript hack</a> to take timed <code>&lt;span&gt;</code>s out of an in-page transcript to superimpose over a video.</p>

<h2>WebM video format</h2>
<p>The big news of the last month is that Google open-sourced the VP8 video codec that it acquired when it <a href="http://investor.google.com/releases/2010/0219.html">took over On2 Technologies</a>. When combined with the Vorbis audio codec (that Spotify uses) and wrapped in a subset of the <a href="http://en.wikipedia.org/wiki/Matroska">Matroska container format</a>, it&#8217;s collectively known as <a href="http://www.webmproject.org/">WebM</a>.</p>

<p>All YouTube videos are being transcoded to WebM, and Adobe have also announced they will include it in their Flash player. It&#8217;s available in an <a href="http://www.opera.com/browser/next">Opera 10.60 beta</a>, a <a href="http://nightly.mozilla.org/webm/">Firefox testing build</a>, and a <a href="http://www.chromium.org/getting-involved/dev-channel">Chromium dev channel</a>. Even Microsoft have said that IE9 will support it if the codec is installed on the computer.</p>

<p>The <a href="http://www.streamingmedia.com/Articles/Editorial/Featured-Articles/First-Look-H.264-and-VP8-Compared-67266.aspx">VP8 video codec itself is high-quality</a> (Google had said that Ogg Theora wasn&#8217;t good enough compression-to-quality for YouTube, but Theora was based on the VP3 precursor to VP8). It&#8217;s available for <a href="http://zaheer.merali.org/articles/2010/06/02/webm-and-vp8-streaming-live-from-flumotion/">streaming</a> too.</p>

<p>If you want to encode to WebM, you can try the <a href="http://www.mirovideoconverter.com/">Miro Video Converter</a> utility. Although it doesn&#8217;t allow you to optimise settings, it&#8217;s very easy to use. As the codec becomes more widespread, expect to see many more tools for content creation, editing, and transcoding.</p>

<p>Once production versions of the browsers are available, you should encode your videos with WebM as the first option, Ogg for older versions of Opera, Firefox and Chrome, falling back to royalty-encumbered H.264 for Safari and links to downloads or a Flash player for legacy browsers:</p>

<pre><code>&lt;video controls&gt;
&lt;source src=video.webm type='video/webm; codecs="vorbis,vp8"'&gt;
&lt;source src=video.mp4 type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'&gt;
&lt;source src=video.ogv type='video/ogg; codecs="theora, vorbis"'&gt;
&lt;!-- embed Flash here --&gt;
&lt;p&gt;Your browser does not support video; download the &lt;a href=&quot;video.webm&quot;&gt;WebM&lt;/a&gt;, &lt;a href=&quot;video.mp4&quot;&gt;mp4&lt;/a&gt; or &lt;a href=&quot;video.ogg&quot;&gt;Ogg&lt;/a&gt; video for off-line viewing.&lt;/p&gt;
&lt;/video&gt;</code>
</pre>

<p>If, however, you&#8217;re having problems with the iPad, put the MP4 version first in the <code>&lt;source&gt;</code> element; apparently there&#8217;s a bug that causes the iPad only to see the first <code>&lt;source&gt;</code> element.</p>

<p>It’s a long haul, and it’s not over yet, but <code>&lt;track&gt;</code> and .webM show significant progress towards our goal of accessible, open, and royalty-free video playing natively in the browser.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/youtube-and-vimeo-support-html5-video/" rel="bookmark" class="crp_title">YouTube and Vimeo support HTML5 Video</a></li><li><a href="http://html5doctor.com/the-video-element/" rel="bookmark" class="crp_title">The video element</a></li><li><a href="http://html5doctor.com/native-audio-in-the-browser/" rel="bookmark" class="crp_title">Native Audio in the browser</a></li><li><a href="http://html5doctor.com/your-questions-answered-8/" rel="bookmark" class="crp_title">Your Questions Answered #8</a></li><li><a href="http://html5doctor.com/your-questions-answered-1/" rel="bookmark" class="crp_title">Your questions answered #1</a></li></ul></div>


Share and Save:


	<a rel="nofollow"  href="http://twitter.com/home?status=Video%3A%20the%20track%20element%20and%20webM%20codec%20-%20http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;title=Video%3A%20the%20track%20element%20and%20webM%20codec&amp;bodytext=There%20are%20a%20couple%20of%20interesting%20developments%20in%20the%20world%20of%20HTML5%20multimedia%20that%20you%27ll%20be%20interested%20in%26mdash%3Bthe%20webM%20video%20format%2C%20and%20a%20proposed%20solution%20to%20HTML5%20multimedia%20accessibility." title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;title=Video%3A%20the%20track%20element%20and%20webM%20codec" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;title=Video%3A%20the%20track%20element%20and%20webM%20codec&amp;notes=There%20are%20a%20couple%20of%20interesting%20developments%20in%20the%20world%20of%20HTML5%20multimedia%20that%20you%27ll%20be%20interested%20in%26mdash%3Bthe%20webM%20video%20format%2C%20and%20a%20proposed%20solution%20to%20HTML5%20multimedia%20accessibility." title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;title=Video%3A%20the%20track%20element%20and%20webM%20codec" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Video%3A%20the%20track%20element%20and%20webM%20codec&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;t=Video%3A%20the%20track%20element%20and%20webM%20codec" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;title=Video%3A%20the%20track%20element%20and%20webM%20codec&amp;annotation=There%20are%20a%20couple%20of%20interesting%20developments%20in%20the%20world%20of%20HTML5%20multimedia%20that%20you%27ll%20be%20interested%20in%26mdash%3Bthe%20webM%20video%20format%2C%20and%20a%20proposed%20solution%20to%20HTML5%20multimedia%20accessibility." title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Video%3A%20the%20track%20element%20and%20webM%20codec&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;t=Video%3A%20the%20track%20element%20and%20webM%20codec" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;title=Video%3A%20the%20track%20element%20and%20webM%20codec&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=There%20are%20a%20couple%20of%20interesting%20developments%20in%20the%20world%20of%20HTML5%20multimedia%20that%20you%27ll%20be%20interested%20in%26mdash%3Bthe%20webM%20video%20format%2C%20and%20a%20proposed%20solution%20to%20HTML5%20multimedia%20accessibility." title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;h=Video%3A%20the%20track%20element%20and%20webM%20codec" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fvideo-the-track-element-and-webm-codec%2F&amp;t=Video%3A%20the%20track%20element%20and%20webM%20codec&amp;s=There%20are%20a%20couple%20of%20interesting%20developments%20in%20the%20world%20of%20HTML5%20multimedia%20that%20you%27ll%20be%20interested%20in%26mdash%3Bthe%20webM%20video%20format%2C%20and%20a%20proposed%20solution%20to%20HTML5%20multimedia%20accessibility." title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/><p><a href="http://html5doctor.com/video-the-track-element-and-webm-codec/" rel="bookmark">Video: the track element and webM codec</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on June 24, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/video-the-track-element-and-webm-codec/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>HTML5 Custom Data Attributes (data-*)</title>
		<link>http://html5doctor.com/html5-custom-data-attributes/</link>
		<comments>http://html5doctor.com/html5-custom-data-attributes/#comments</comments>
		<pubDate>Thu, 27 May 2010 13:50:08 +0000</pubDate>
		<dc:creator>Chris Bewick</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1874</guid>
		<description><![CDATA[<p>Have you ever found yourself using element <code>class</code> names or <code>rel</code> attributes to store arbitrary snippets of metadata for the sole purpose of making your JavaScript simpler? If you have, then I have some exciting news for you! If you haven&#39;t and you&#39;re thinking, <q>Wow, that&#39;s a great idea!</q> I implore you to rid your mind of that thought immediately and continue reading.</p>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
			</a>
		</div><p>Have you ever found yourself using element <code>class</code> names or <code>rel</code> attributes to store arbitrary snippets of metadata for the sole purpose of making your JavaScript simpler? If you have, then I have some exciting news for you! If you haven&#39;t and you&#39;re thinking, <q>Wow, that&#39;s a great idea!</q> I implore you to rid your mind of that thought immediately and continue reading.</p>

<p>Thanks to <abbr>HTML</abbr>5, we now have the ability to embed custom data attributes on all <abbr>HTML</abbr> elements. These new custom data attributes consist of two parts:</p>

<dl> <dt>Attribute Name</dt> <dd>The data attribute name must be at least one character long and must be prefixed with &#39;<code>data-</code>&#39;. It should not contain any uppercase letters.</dd> <dt>Attribute Value</dt> <dd>The attribute value can be any string.</dd></dl>

<p>Using this syntax, we can add application data to our markup as shown below:</p>

<pre><code>&lt;ul id="vegetable-seeds"&gt;
  &lt;li data-spacing="10cm" data-sowing-time="March to June"&gt;Carrots&lt;/li&gt;
  &lt;li data-spacing="30cm" data-sowing-time="February to March"&gt;Celery&lt;/li&gt;
  &lt;li data-spacing="3cm" data-sowing-time="March to September"&gt;Radishes&lt;/li&gt;
&lt;/ul&gt; </code></pre>

<p>We can now use this stored data in our site&#8217;s JavaScript to create a richer, more engaging user experience. Imagine that when a user clicks on a vegetable a new layer opens up in the browser displaying the additional seed spacing and sowing instructions. Thanks to the <code>data-</code> attributes we&#8217;ve added to our <code>&lt;li&gt;</code> elements, we can now display this information instantly without having to worry about making any Ajax calls and without having to make any server-side database queries.</p>

<p>Prefixing the custom attributes with <code>data-</code> ensures that they will be completely ignored by the user agent. As far as the browser and indeed the website&#8217;s end user are concerned, this data does not exist.</p>

<p>The spec says (emphasis ours):</p>

<blockquote><p><strong>Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.</strong></p>

<p>These attributes are not intended for use by software that is independent of the site that uses the attributes.</p>

<p>Every HTML element may have any number of custom data attributes specified, with any value.</p>

<cite><a href="http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data">W3C Specification</a></cite></blockquote>


<h2>How can I use data attributes?</h2>

<p>As custom data attributes are valid <abbr>HTML</abbr>5, they can be used in any browser that supports <abbr>HTML</abbr>5 doctypes. Thankfully, this is pretty much all of them. In addition to aiding backwards compatibility, this also ensures that custom data attributes will remain a scalable, cross-platform solution well into the future.</p>

<p>Now that we have a broad understanding of what data attributes are, let&#39;s take a look at how they can be used:</p>

<ul>
	<li>To store the initial height or opacity of an element which might be required in later JavaScript animation calculations</li>
	<li>To store parameters for a Flash movie that&#8217;s loaded via JavaScript</li>
	<li>To store custom web analytics tagging data as demonstrated by <a title="Google Analytics Tagging with HTML5 data-* Attributes" href="http://jasonkarns.com/blog/2010/03/10/google-analytics-tagging/">Jason Karns</a></li>
	<li>To store data about the health, ammo, or lives of an element in a JavaScript game</li>
	<li>To power accessible JavaScript <code>&lt;video&gt;</code> subtitles as demonstrated by <a title="Accessible HTML5 Video with JavaScripted captions" href="http://dev.opera.com/articles/view/accessible-html5-video-with-javascripted-captions/">Bruce Lawson</a></li>
</ul>



<h2>What shouldn&#8217;t I use data attributes for?</h2>

<p>Although flexible, data attributes aren&#8217;t an appropriate solution for all problems.</p>

<ul>
	<li>Data attributes should not be used if there is a existing attribute or element which is more appropriate for storing your data. For example, date/time data should probably be presented semantically in a time element instead rather than stored in custom data attributes.</li>
	<li>Custom data attributes are not intended to compete with microformats. It is clearly stated in the spec that the data is not intended to be publicly usable. External software should not interact with it. Marking up contact details or event details using custom data attributes would be wrong, unless of course it is only intended to be used by your own internal scripts.</li>
	<li>The presence/absence of a particular data attribute should not be used as a <abbr>CSS</abbr> hook for any styling. Doing so would suggest that the data you are storing is of immediate importance to the user and should be marked up in a more semantic and accessible manner.</li>
</ul>



<h2>Using <code>data-</code> attributes with JavaScript</h2>

<p>Now that we understand what custom <code>data-</code> attributes are and when we can use them, we should probably take a look at how we can interact with them using JavaScript.</p>

<p>If we wanted to retrieve or update these attributes using existing, native JavaScript, then we can do so using the <code>getAttribute</code> and <code>setAttribute</code> methods as shown below:</p>

<pre><code>&lt;div id='strawberry-plant' data-fruit='12'&gt;&lt;/div&gt;

&lt;script&gt;
// 'Getting' data-attributes using getAttribute
var plant = document.getElementById('strawberry-plant');
var fruitCount = plant.getAttribute('data-fruit'); // fruitCount = '12'

// 'Setting' data-attributes using setAttribute
plant.setAttribute('data-fruit','7'); // Pesky birds
&lt;/script&gt;</code></pre>

<p>This method will work in all modern browsers, but it is not how <code>data-</code> attributes are intended to be used. The second (new and improved) way to achieve the same thing is by accessing an element&#8217;s <code>dataset</code> property. This <code>dataset</code> property — part of the new <abbr>HTML</abbr>5 JavaScript <abbr>API</abbr>s — will return a <code>DOMStringMap</code> object of all the selected element&#39;s <code>data-</code> attributes. When using this approach, rather than using the full attribute name, you can ditch the <code>data-</code> prefix and refer to the custom data directly using the name you have assigned to it. Data attribute names which contain hyphens will be stripped of their hyphens and converted to <a href="http://en.wikipedia.org/wiki/CamelCase">CamelCase</a>.</p>

<pre><code>&lt;div id='sunflower' data-leaves='47' data-plant-height='2.4m'&gt;&lt;/div&gt;

&lt;script&gt;
// 'Getting' data-attributes using dataset 
var plant = document.getElementById('sunflower');
var leaves = plant.dataset.leaves; // leaves = 47;

// 'Setting' data-attributes using dataset
var tallness = plant.dataset.plantHeight; // 'plant-height' -&gt; 'plantHeight'
plant.dataset.plantHeight = '3.6m';  // Cracking fertiliser
&lt;/script&gt;</code></pre>

<p>If, at some point in your script, a specific <code>data-</code> attribute becomes redundant and is no longer needed, it is also possible to completely remove that attribute from the DOM element by setting it to a value of <code>null</code>.</p>

<pre><code>plant.dataset.leaves = null; // Caterpillars attack!</code></pre>

<p>Unfortunately, the new <code>dataset</code> property has not yet been implemented in any browser, so in the meantime it&#8217;s best to use <code>getAttribute</code> and <code>setAttribute</code> as demonstrated earlier.</p>

<p>While developing your application, you may find it useful to be able to select elements based on the presence of — or indeed the specific values of — their custom <code>data-</code> attributes. This can be achieved quickly and easily using <code>querySelectorAll</code> as shown below:</p>

<pre><code>// Select all elements with a 'data-flowering' attribute
document.querySelectorAll('[data-flowering]');

// Select all elements with red leaves
document.querySelectorAll('[data-foliage-colour="red"]');</code></pre>



<h2>A word of warning</h2>

<p>As data attributes become more widely used, the potential for clashes in naming conventions becomes much greater. If you use an unimaginative attribute name such as <code>data-height</code>, then it is likely you will eventually come across a library or plugin that uses the same attribute name. Multiple scripts getting and setting a common <code>data-</code> attribute will probably cause chaos. In order to avoid this, I encourage people to choose a standard string (perhaps the site/plugin name) to prefix all their <code>data-</code> attributes — e.g. <code>data-html5doctor-height</code> or <code>data-my-plugin-height</code>.</p>



<h2>Summary</h2>

<p>Custom <code>data-</code> attributes are a great way to simplify the storage of application data in your web pages. Although you can&#8217;t utilise the new JavaScript <abbr>API</abbr>s just yet, you can enjoy great success using <code>getAttribute</code> and <code>setAttribute</code> safe in the knowledge that they will work in all major browsers.</p>



<h2>Homework</h2>

<p>If you&#8217;re super keen to have a play with the new <code>dataset</code> property but disappointed that it hasn&#8217;t been implemented, fear not!, for there is a light at the end of the tunnel. You might be interested in looking at <a href="/author/remys/">Dr Remy&#8217;s</a>  <a title="Code to enable dataset functionality in some browsers" href="http://gist.github.com/362081">experimental code</a>, which partially enables the <code>dataset</code> functionality in some browsers by editing the <code>Element.prototype</code>.</p>

<p>The code supports the retrieval of <code>data-</code> attributes in the latest versions of Firefox, Safari, Opera, and Chrome, but sadly will not work in any version of <abbr>IE</abbr> (since <abbr>IE</abbr> does not expose the Element object). This code also partially supports the setting of data attributes, but it will only store the new attribute values within the JavaScript and will not update the <abbr>DOM</abbr> element as a full, native implementation of the <code>dataset</code> property would. Although this code is mainly a proof of concept, it may be useful for mobile application or intranet development in closed environments where cross-browser (<abbr>IE</abbr>) compatibility is not an issue.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/your-questions-answered-8/" rel="bookmark" class="crp_title">Your Questions Answered #8</a></li><li><a href="http://html5doctor.com/native-drag-and-drop/" rel="bookmark" class="crp_title">Native Drag and Drop</a></li><li><a href="http://html5doctor.com/your-questions-5/" rel="bookmark" class="crp_title">Your Questions Answered #5</a></li><li><a href="http://html5doctor.com/video-the-track-element-and-webm-codec/" rel="bookmark" class="crp_title">Video: the track element and webM codec</a></li><li><a href="http://html5doctor.com/the-video-element/" rel="bookmark" class="crp_title">The video element</a></li></ul></div>


Share and Save:


	<a rel="nofollow"  href="http://twitter.com/home?status=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29%20-%20http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29&amp;bodytext=Have%20you%20ever%20found%20yourself%20using%20element%20class%20names%20or%20rel%20attributes%20to%20store%20arbitrary%20snippets%20of%20metadata%20for%20the%20sole%20purpose%20of%20making%20your%20JavaScript%20simpler%3F%20If%20you%20have%2C%20then%20I%20have%20some%20exciting%20news%20for%20you%21%20If%20you%20haven%26%2339%3Bt%20and%20you%26%2339%3Bre%20thinking%2C%20Wow%2C%20that%26%2339%3Bs%20a%20great%20idea%21%20I%20implore%20you%20to%20rid%20your%20mind%20of%20that%20thought%20immediately%20and%20continue%20reading." title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29&amp;notes=Have%20you%20ever%20found%20yourself%20using%20element%20class%20names%20or%20rel%20attributes%20to%20store%20arbitrary%20snippets%20of%20metadata%20for%20the%20sole%20purpose%20of%20making%20your%20JavaScript%20simpler%3F%20If%20you%20have%2C%20then%20I%20have%20some%20exciting%20news%20for%20you%21%20If%20you%20haven%26%2339%3Bt%20and%20you%26%2339%3Bre%20thinking%2C%20Wow%2C%20that%26%2339%3Bs%20a%20great%20idea%21%20I%20implore%20you%20to%20rid%20your%20mind%20of%20that%20thought%20immediately%20and%20continue%20reading." title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;t=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29&amp;annotation=Have%20you%20ever%20found%20yourself%20using%20element%20class%20names%20or%20rel%20attributes%20to%20store%20arbitrary%20snippets%20of%20metadata%20for%20the%20sole%20purpose%20of%20making%20your%20JavaScript%20simpler%3F%20If%20you%20have%2C%20then%20I%20have%20some%20exciting%20news%20for%20you%21%20If%20you%20haven%26%2339%3Bt%20and%20you%26%2339%3Bre%20thinking%2C%20Wow%2C%20that%26%2339%3Bs%20a%20great%20idea%21%20I%20implore%20you%20to%20rid%20your%20mind%20of%20that%20thought%20immediately%20and%20continue%20reading." title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;t=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;title=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=Have%20you%20ever%20found%20yourself%20using%20element%20class%20names%20or%20rel%20attributes%20to%20store%20arbitrary%20snippets%20of%20metadata%20for%20the%20sole%20purpose%20of%20making%20your%20JavaScript%20simpler%3F%20If%20you%20have%2C%20then%20I%20have%20some%20exciting%20news%20for%20you%21%20If%20you%20haven%26%2339%3Bt%20and%20you%26%2339%3Bre%20thinking%2C%20Wow%2C%20that%26%2339%3Bs%20a%20great%20idea%21%20I%20implore%20you%20to%20rid%20your%20mind%20of%20that%20thought%20immediately%20and%20continue%20reading." title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;h=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fhtml5-custom-data-attributes%2F&amp;t=HTML5%20Custom%20Data%20Attributes%20%28data-%2A%29&amp;s=Have%20you%20ever%20found%20yourself%20using%20element%20class%20names%20or%20rel%20attributes%20to%20store%20arbitrary%20snippets%20of%20metadata%20for%20the%20sole%20purpose%20of%20making%20your%20JavaScript%20simpler%3F%20If%20you%20have%2C%20then%20I%20have%20some%20exciting%20news%20for%20you%21%20If%20you%20haven%26%2339%3Bt%20and%20you%26%2339%3Bre%20thinking%2C%20Wow%2C%20that%26%2339%3Bs%20a%20great%20idea%21%20I%20implore%20you%20to%20rid%20your%20mind%20of%20that%20thought%20immediately%20and%20continue%20reading." title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/><p><a href="http://html5doctor.com/html5-custom-data-attributes/" rel="bookmark">HTML5 Custom Data Attributes (data-*)</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on May 27, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/html5-custom-data-attributes/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Your Questions Answered #5</title>
		<link>http://html5doctor.com/your-questions-5/</link>
		<comments>http://html5doctor.com/your-questions-5/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 14:30:55 +0000</pubDate>
		<dc:creator>Richard Clark</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Elements]]></category>
		<category><![CDATA[Questions]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[aside]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[nav]]></category>
		<category><![CDATA[outline]]></category>
		<category><![CDATA[section]]></category>
		<category><![CDATA[sectioning]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1400</guid>
		<description><![CDATA[We're back with our first round up of your questions for 2010. In this article we'll be covering a range of topics including sections and sectioning, the <code>img</code> element, scaling video and a proposal for a <code>field</code> element. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p><img src="http://html5doctor.com/wp-content/uploads/2009/07/html5doctor-treatment.gif" alt="Doctor treating a patient illustration" class="alignright size-full wp-image-424" /> We&#8217;re back with our first roundup of your questions for 2010. In this article, we&#8217;ll be covering a range of topics including sections and sectioning, the <code>&lt;img&gt;</code> element, scaling video, and a proposal for a <code>&lt;field&gt;</code> element. </p>
<h2>Headers and sidebars</h2>
<p>Ad asked:</p>
<blockquote><p>Hello,</p>
<p>I have 2 questions:</p>
<p>1. If I have my main navigation above the masterhead would best practise be having the nav tag inside of a header tag with the h1 and h2 in a hgroup? Or should the nav and header tag be separate?</p>
<p>2. I am building a blog in HTML5. It has a blog-like sidebar with articles, contact info and about info in it. Would the best tag to wrap this in be section or aside?</p>
<p>Thank you so much for your time,<br />
Ad Taylor</p></blockquote>
<p>Placing your <code>&lt;nav&gt;</code> within your <code>&lt;header&gt;</code> is fine and valid. However, if it makes more sense to leave it outside, then you can do that too. You don&#8217;t need to put the <code>&lt;hgroup&gt;</code> inside the <code>&lt;nav&gt;</code> though.</p>
<p>See our articles on <a href="http://html5doctor.com/the-header-element/"><code>&lt;header&gt;</code></a> and <a href="http://html5doctor.com/nav-element/"><code>&lt;nav&gt;</code></a> for more on this.</p>
<p>Regarding your second question, I would use <code>&lt;aside&gt;</code> (as we&#8217;ve done on the HTML5 doctor site) and then use multiple sections within that. Also see Bruce&#8217;s article on <a href="http://html5doctor.com/designing-a-blog-with-html5/">Designing a blog with HTML5</a>.</p>
<p>Hope that helps.</p>
<p>Cheers, Rich</p>
<h2>HTML5 <code>&lt;img&gt;</code> element</h2>
<p>Martijn asked:</p>
<blockquote><p>As you are, according to the slogan, &#8220;helping [me] implement HTML5 today,&#8221; I thought to bother you people with a spec. related question.</p>
<p>What should an UA do with an image without specified width and height attributes?</p>
<p>The dimension attributes part of the specification keeps stating &#8220;if specified&#8221; for every rule but doesn&#8217;t give any &#8220;if not specified&#8221;.</p>
<p>The part of the specification defining the img element itself does not state anything of importance about the dimension attributes apart from how the attributes in the DOM should be created by the UA.</p>
<p>Interesting is to note that they have omitted these attributes in all their img element examples.</p>
<p>In the dimension attribute section they go state the following.</p>
<p> &#8211; The dimension attributes are not intended to be used to stretch the image.</p>
<p>So we can only use them to make images smaller? This is odd as well so let&#8217;s say by stretch they mean to say both expending and shrinking in size. In this case the attributes can only be used for two cases:</p>
<p>1. To state the exact width and height of the image. Something that seems redundant unless not using those attributes means the UA can display the image at any size (which it might, as nothing about this is defined in the spec.).</p>
<p>2. To give a 0 in both attributes. By this I am telling the UA that the image is not to be seen by the user.</p>
<p>Am I missing something or is the specification missing this?</p>
<p>Looking forward to getting your prescription <img src='http://html5doctor.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Kind Regards, Martijn</p></blockquote>
<p>If no dimension attributes are specified, the browser will leave no space for the image, and once the image has been loaded (after the rest of the page), it will then need to reflow the entire page, as that&#8217;s the first time it knows the size of the image. This can cause the content you&#8217;re reading scrolling off the page.</p>
<p>If you give the size of the image as attributes in the HTML, the browser will leave space and render the image there once it&#8217;s loaded without reflowing the page. On a mobile phone, reflowing the page unnecessarily drains the battery, and users can get vertigo from the page&#8217;s text jumping around to accommodate images.</p>
<p>Thanks, Bruce</p>
<h2>Section and Sectioning</h2>
<p>Yanoo asked:</p>
<blockquote><p>Hi,</p>
<p>What do you mean when you are talking about &#8220;sectioning&#8221;? And why don&#8217;t header and footer require sectioning?</p>
<p>I think about section and sectioning like about part of something defined. News, comment, page content, sidebar, *header*, and *footer*. Is it bad representation?</p></blockquote>
<p>Sectioning relates to the headings in some block of related content and defining what is related to what in a hierarchy of headings (<code>&lt;h1&gt;</code>&ndash;<code>&lt;h6&gt;</code>). The outlining algorithm can produce a table of contents from the nested <code>&lt;section&gt;</code>, <code>&lt;article&gt;</code>, <code>&lt;nav&gt;</code>, and <code>&lt;aside&gt;</code> elements.</p>
<p>Headers and footers themselves do not change the outline; a header or footer may contain no headings. If a header or footer <em>does</em> contain a heading, then that heading does come into the outline. See our article on <a href="http://html5doctor.com/the-section-element/">the section element</a>.</p>
<p>Thanks, Bruce</p>
<h2>Scaling the Video</h2>
<p>Ian asked:</p>
<blockquote><p>Hi there,</p>
<p>Not sure if this question is an appropriate one, but any help would be really appreciated.</p>
<p>I&#8217;m going about updating my video website, chutney.ie, and would love to implement HTML5. I am interested in replicating the scaling effect/style used on the <a href="http://www.mozilla.com/en-US/firefox/3.5/firstrun/">Mozilla welcome page</a>.</p>
<p>Not being overly knowledgeable in this area, I would love to know how to begin &mdash; is this effect a Flash based animation, or something that can be achieved with HTML alone?</p>
<p>Again, any nudge in the right direction would be great.</p>
<p>Many thanks,</p>
<p>Ian</p></blockquote>
<p>I&#8217;m not sure how Mozilla did it, but you can use some of the Webkit and Mozilla transforms on the <code>&lt;video&gt;</code> element. For example, you can cause the video to grow on hover &mdash; <a href="http://people.opera.com/patrickl/articles/introduction-html5-video/transitions/">see this example in Chrome, Safari, or Opera</a>. You can also use the <code>:target</code> pseudoclass to initiate animations. Alternatively, you can use a JavaScript <code>onClick</code> event to create the same effect. </p>
<p>You can also combine <code>&lt;video&gt;</code> and <code>&lt;canvas&gt;</code> to provide some interesting results (laying the <code>&lt;canvas&gt;</code> over the <code>&lt;video&gt;</code>). For more on the <code>&lt;video&gt;</code> element and what it can do, please read the <a href="http://dev.opera.com/articles/view/introduction-html5-video/">Introduction to <abbr>HTML</abbr>5 Video</a> on dev Opera written by <a href="http://twitter.com/brucel">Bruce Lawson</a> and <a href="http://twitter.com/patrick_h_lauke">Patrick Lauke</a>.</p>
<p>Cheers, Rich</p>
<h2>We need a <code>&lt;field&gt;</code> tag</h2>
<p>John wrote in and proposed a field element:</p>
<blockquote><p>Hey there. First off thanks for the site. I was excited to find it. I spent a little time on the W3C site and honestly couldn&#8217;t figure out how to submit suggestions there. So going to submit mine to you guys and maybe you can pass it on (if it is good) or point me to someone that can help. Ok to the point:</p>
<p>We are getting nice new tags to with HTML5 (nav, footer, etc) to help us create more semantic code. I think what we really need is a <code>field</code> tag &mdash; after all what are fieldsets sets of?</p>
<p>Everyone wraps up their labels and inputs with some element. Some of us do this with UL, some people do it with DT/DD, some with DIVs and some people out there insist that a form is tabular data.</p>
<p>We are all just bastardizing these elements because there is no clear semantic wrapper for field elements of a form.</p>
<p>I think you get the point. I&#8217;m trying to keep this email short. If you think there is anything to this argument, I have a more detailed summary (with example code) at:</p>
<p><a href="http://john.mirick.me/2009/10/what-is-really-set-of-shouldnt-we-have.html">http://john.mirick.me/2009/10/what-is-really-set-of-shouldnt-we-have.html</a></p>
<p>I would love to hear your thoughts on this.</p>
<p>Thanks!<br />
John</p></blockquote>
<p>While a field element would be nice &mdash; it would stop the argument over how best to mark-up forms &mdash; you have to ask yourself whether or not it actually adds any semantic or functional value to an HTML document. Yes, wrapping inputs and their labels in a field would make things easier to read and drop the need for the <code>for</code> attribute on the label (since the relationship can be assumed), but doing so would not be backwards compatible. In theory, we could continue to add <code>for</code> until there is a suitable time to drop it, but again I question the value of such a tag.</p>
<p>The purpose of wrapping form input/label pairs is generally to ease styling. My personal stance is that unless there are case studies showing how such an element can add more value to HTML forms, this proposal won&#8217;t make it very far.</p>
<p>Regards, Mike</p>
<h2>Got a question for us?</h2>
<p>That wraps up this round of questions. If you&#8217;ve got a query about the HTML5 spec or how to implement it, you can <a href="http://html5doctor.com/ask-the-doctor/">get in touch</a> with us and we&#8217;ll do our best to help. </p>
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/your-questions-answered-8/" rel="bookmark" class="crp_title">Your Questions Answered #8</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-7/" rel="bookmark" class="crp_title">Your Questions Answered #7</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-6/" rel="bookmark" class="crp_title">Your Questions Answered #6</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-4/" rel="bookmark" class="crp_title">Your Questions Answered #4</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-10/" rel="bookmark" class="crp_title">Your Questions Answered #10</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=Your%20Questions%20Answered%20%235%20-%20http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;title=Your%20Questions%20Answered%20%235&amp;bodytext=We%27re%20back%20with%20our%20first%20round%20up%20of%20your%20questions%20for%202010.%20In%20this%20article%20we%27ll%20be%20covering%20a%20range%20of%20topics%20including%20sections%20and%20sectioning%2C%20the%20img%20element%2C%20scaling%20video%20and%20a%20proposal%20for%20a%20field%20element.%20" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;title=Your%20Questions%20Answered%20%235" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;title=Your%20Questions%20Answered%20%235&amp;notes=We%27re%20back%20with%20our%20first%20round%20up%20of%20your%20questions%20for%202010.%20In%20this%20article%20we%27ll%20be%20covering%20a%20range%20of%20topics%20including%20sections%20and%20sectioning%2C%20the%20img%20element%2C%20scaling%20video%20and%20a%20proposal%20for%20a%20field%20element.%20" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;title=Your%20Questions%20Answered%20%235" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Your%20Questions%20Answered%20%235&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;t=Your%20Questions%20Answered%20%235" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;title=Your%20Questions%20Answered%20%235&amp;annotation=We%27re%20back%20with%20our%20first%20round%20up%20of%20your%20questions%20for%202010.%20In%20this%20article%20we%27ll%20be%20covering%20a%20range%20of%20topics%20including%20sections%20and%20sectioning%2C%20the%20img%20element%2C%20scaling%20video%20and%20a%20proposal%20for%20a%20field%20element.%20" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Your%20Questions%20Answered%20%235&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;t=Your%20Questions%20Answered%20%235" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;title=Your%20Questions%20Answered%20%235&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=We%27re%20back%20with%20our%20first%20round%20up%20of%20your%20questions%20for%202010.%20In%20this%20article%20we%27ll%20be%20covering%20a%20range%20of%20topics%20including%20sections%20and%20sectioning%2C%20the%20img%20element%2C%20scaling%20video%20and%20a%20proposal%20for%20a%20field%20element.%20" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;h=Your%20Questions%20Answered%20%235" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-5%2F&amp;t=Your%20Questions%20Answered%20%235&amp;s=We%27re%20back%20with%20our%20first%20round%20up%20of%20your%20questions%20for%202010.%20In%20this%20article%20we%27ll%20be%20covering%20a%20range%20of%20topics%20including%20sections%20and%20sectioning%2C%20the%20img%20element%2C%20scaling%20video%20and%20a%20proposal%20for%20a%20field%20element.%20" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/your-questions-5/" rel="bookmark">Your Questions Answered #5</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on March 2, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/your-questions-5/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>The time element (and microformats)</title>
		<link>http://html5doctor.com/the-time-element/</link>
		<comments>http://html5doctor.com/the-time-element/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 14:49:14 +0000</pubDate>
		<dc:creator>Bruce Lawson</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Elements]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1293</guid>
		<description><![CDATA[
			
				
			
		
Microformats are a way of adding extra semantic information to a webpage using HTML classes &#8212; information like an event&#8217;s date and time, a person&#8217;s phone number, an organisation&#8217;s email address, etc.
They aren&#8217;t a &#8220;standard&#8221; per se, but they are a widely adopted convention within the geek community. And since they use an agreed-upon set [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.microformats.org/">Microformats</a> are a way of adding extra semantic information to a webpage using <abbr>HTML</abbr> classes &mdash; information like an event&#8217;s date and time, a person&#8217;s phone number, an organisation&#8217;s email address, etc.</p>
<p>They aren&#8217;t a &#8220;standard&#8221; <i>per se</i>, but they are a widely adopted convention within the geek community. And since they use an agreed-upon set of class names, they are as compatible with <abbr>HTML</abbr>5 as they are with <abbr>HTML</abbr>4 or <abbr>XHTML</abbr>.</p>
<p><abbr>HTML</abbr>5 offers one potential addition to the microformats arsenal. Because earlier versions of some microformats presented accessibility problems in the way they encoded dates and times (see an article called <a href="http://www.webstandards.org/2007/04/27/haccessibility/">hAccessibility</a> that I co-wrote with James Craig), <abbr>HTML</abbr>5 offers a new element for unambiguously encoding dates and times for machines while still displaying them in a human-readable way.</p>
<p>The format is very simple: <code>&lt;time datetime="2009-11-13"&gt;13 November 2009&lt;/time&gt;</code>:</p>
<blockquote><p>The time element represents either a time on a 24 hour clock, or a precise date in the proleptic Gregorian calendar, optionally with a time and a time-zone offset.<br />
<footer><cite><a href="http://dev.w3.org/html5/spec/text-level-semantics.html#the-time-element">W3C specfication</a></cite></footer></p></blockquote>
<p>You can have whatever you want between the tags, so:</p>
<pre><code>&lt;time datetime=&quot;2009-11-13&quot;&gt;13 November 2009&lt;/time&gt;
&lt;time datetime=&quot;2009-11-13&quot;&gt;13&lt;sup&gt;th&lt;/sup&gt; November&lt;/time&gt;
&lt;time datetime=&quot;2010-11-13&quot;&gt;Bruce's 21st birthday&lt;/time&gt;
&lt;time datetime=&quot;2010-11-13T20:00&quot;&gt;8PM on my birthday&lt;/time&gt;
&lt;time datetime="2010-11-13T20:00+09:00"&gt;8PM on my birthday—in Tokyo&lt;/time&gt;</code></pre>
<p>are all equally valid.</p>
<p>Note that the last example has an optional timezone offset (+09:00) too (thanks, Oli!). You can also use “Z” (e.g. <code>2010-11-13T20:00<b>Z</b></code>) to represent <a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">Universal Coordinated Time (<abbr>UTC</abbr>)</a>, which is the equivalent of the timezone +00:00. Finally if you don’t specify a timezone offset the time is “local time” (in this case England).</p>
<h2>The fly in the ointment</h2>
<p>The only trouble with <code>&lt;time&gt;</code> is that the it must contain positive date on the <a href="http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">Proleptic Gregorian calendar</a>, meaning you can&#8217;t encode a date before the Christian Era. Neither can you encode imprecise dates such as &#8220;July 1904&#8243;. Microformats, however, aren&#8217;t subjected to this restriction and are often employed to mark up, for example, very old events on Wikipedia or imprecise dates on museum websites. It&#8217;s likely that authors will continue using the current, more flexible microformat patterns unless the restrictions on the <code>&lt;time&gt;</code> element are lifted. (The <abbr>HTML</abbr>5 working group has been continually petitioned to remove their arbitrary restrictions and widen the scope of time, but with no success).</p>
<p>Perhaps because of this restriction, current microformat clients can&#8217;t consume microformats such as hCalendar if they&#8217;re coded to use <code>&lt;time&gt;</code>. Stefan Schipor wrote to us saying, <q>&#8220;The problem is that I need to parse the site with H2VX or any other similar thing for exporting. Sadly, H2VX doesn&#8217;t seem to read the datetime attribute in the <code>&lt;time&gt;</code> elements. Nor does the FF add-on Tails. I tried the microformats IRC channel and the microformateers twitter account but I didn&#8217;t get any response. Do you know if there is any support for this? It would kill me to add <code>&lt;abbr&gt;</code> elements just for it to work.&#8221;</q></p>
<h2>Incorporating the <code>pubdate</code> attribute</h2>
<p>This doesn&#8217;t mean that <code>&lt;time&gt;</code> is an a waste of time, or that it&#8217;s more trouble than it&#8217;s worth (a white element, as it were). It has a great deal of scope outside microformats, too.</p>
<p>On my personal blog, I use it to mark up publication dates of articles. There is a boolean attribute <code>pubdate</code> specifically for this:</p>
<pre><code>&lt;article&gt;
  &lt;header&gt;
  &lt;h1&gt;My brilliant blogpost&lt;/h1&gt;
  &lt;p&gt;Published on &lt;time datetime=&quot;2010-01-20&quot; pubdate&gt;20 January 2010&lt;/time&gt; in the Sexysocks category.&lt;/p&gt;
  &lt;/header&gt;
  &lt;p&gt;I'm wearing sexy socks! Here's a picture.&lt;/p&gt;
  ...
&lt;/article&gt;</code></pre>
<p>The spec says:</p>
<blockquote><p>The pubdate attribute is a boolean attribute. If specified, it indicates that the date and time given by the element is the publication date and time of the nearest ancestor article element, or, if the element has no ancestor article element, of the document as a whole.</p></blockquote>
<p>You might be wondering why the <code>pubdate</code> attribute is needed at all. Why not just assume that any <code>&lt;time&gt;</code> element in an <code>&lt;article&gt;</code>&#8217;s <code>&lt;header&gt;</code> is its publication date?</p>
<p>Consider this example:</p>
<pre><code>&lt;article&gt;
  &lt;header&gt;
  &lt;h1&gt;Come to my party on &lt;time datetime=&quot;2010-03-01&quot;&gt;1 March&lt;/time&gt;&lt;/h1&gt;
  &lt;p&gt;Published on &lt;time datetime=&quot;2010-01-20&quot; pubdate&gt;20 January 2010&lt;/time&gt; in the Sexysocks category.&lt;/p&gt;
  &lt;/header&gt;
  &lt;p&gt;I'm throwing a sexy socks party at Dr Naughty's Ladyboy Cabaret Roller-disco Bierkeller Pizza-parlour-a-gogo! Do come.&lt;/p&gt;
  ...
&lt;/article&gt;</code></pre>
<p>You&#8217;ll see that there are two dates within the <code>&lt;header&gt;</code>: the date of the actual party and the publication date of the article. The <code>pubdate</code> attribute is required to remove any ambiguity.</p>
<h2>Where could time be used?</h2>
<p>The uses of unambiguous dates in web pages aren&#8217;t hard to imagine. A browser could offer to add events to a user&#8217;s calendar. A Thai-localised browser could offer to transform Gregorian dates into <a href="http://dspace.anu.edu.au/bitstream/1885/41890/3/thai_time.html">Thai Buddhist era dates</a>. Content aggregators can produce visual timelines of events.</p>
<p>Search engines can produce smarter search results. For example, in the recent heavy snow in the UK, I searched for school closures in my town and discovered my kids&#8217; school was closed. After receiving a phone call from the school asking me where my kids were, I re-examined the webpage. In small print at the bottom of the page were the words &quot;Published 5 January 2008&quot;. I expect that operators of search engines would rank more current pages more highly on searches connected with current events.</p>
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/designing-a-blog-with-html5/" rel="bookmark" class="crp_title">Designing a blog with html5</a></li>
<li><a href="http://html5doctor.com/draw-attention-with-mark/" rel="bookmark" class="crp_title">Draw attention with mark</a></li>
<li><a href="http://html5doctor.com/block-level-links-in-html-5/" rel="bookmark" class="crp_title">&#8220;Block-level&#8221; links in HTML5</a></li>
<li><a href="http://html5doctor.com/the-article-element/" rel="bookmark" class="crp_title">The article element</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-6/" rel="bookmark" class="crp_title">Your Questions Answered #6</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=The%20time%20element%20%28and%20microformats%29%20-%20http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;title=The%20time%20element%20%28and%20microformats%29&amp;bodytext=Microformats%20are%20a%20way%20of%20adding%20extra%20semantic%20information%20to%20a%20webpage%20using%20HTML%20classes%20%26mdash%3B%20information%20like%20an%20event%27s%20date%20and%20time%2C%20a%20person%27s%20phone%20number%2C%20an%20organisation%27s%20email%20address%2C%20etc.%0D%0A%0D%0AThey%20aren%27t%20a%20%22standard%22%20per%20se%2C%20but%20they" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;title=The%20time%20element%20%28and%20microformats%29" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;title=The%20time%20element%20%28and%20microformats%29&amp;notes=Microformats%20are%20a%20way%20of%20adding%20extra%20semantic%20information%20to%20a%20webpage%20using%20HTML%20classes%20%26mdash%3B%20information%20like%20an%20event%27s%20date%20and%20time%2C%20a%20person%27s%20phone%20number%2C%20an%20organisation%27s%20email%20address%2C%20etc.%0D%0A%0D%0AThey%20aren%27t%20a%20%22standard%22%20per%20se%2C%20but%20they" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;title=The%20time%20element%20%28and%20microformats%29" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=The%20time%20element%20%28and%20microformats%29&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;t=The%20time%20element%20%28and%20microformats%29" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;title=The%20time%20element%20%28and%20microformats%29&amp;annotation=Microformats%20are%20a%20way%20of%20adding%20extra%20semantic%20information%20to%20a%20webpage%20using%20HTML%20classes%20%26mdash%3B%20information%20like%20an%20event%27s%20date%20and%20time%2C%20a%20person%27s%20phone%20number%2C%20an%20organisation%27s%20email%20address%2C%20etc.%0D%0A%0D%0AThey%20aren%27t%20a%20%22standard%22%20per%20se%2C%20but%20they" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=The%20time%20element%20%28and%20microformats%29&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;t=The%20time%20element%20%28and%20microformats%29" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;title=The%20time%20element%20%28and%20microformats%29&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=Microformats%20are%20a%20way%20of%20adding%20extra%20semantic%20information%20to%20a%20webpage%20using%20HTML%20classes%20%26mdash%3B%20information%20like%20an%20event%27s%20date%20and%20time%2C%20a%20person%27s%20phone%20number%2C%20an%20organisation%27s%20email%20address%2C%20etc.%0D%0A%0D%0AThey%20aren%27t%20a%20%22standard%22%20per%20se%2C%20but%20they" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;h=The%20time%20element%20%28and%20microformats%29" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fthe-time-element%2F&amp;t=The%20time%20element%20%28and%20microformats%29&amp;s=Microformats%20are%20a%20way%20of%20adding%20extra%20semantic%20information%20to%20a%20webpage%20using%20HTML%20classes%20%26mdash%3B%20information%20like%20an%20event%27s%20date%20and%20time%2C%20a%20person%27s%20phone%20number%2C%20an%20organisation%27s%20email%20address%2C%20etc.%0D%0A%0D%0AThey%20aren%27t%20a%20%22standard%22%20per%20se%2C%20but%20they" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/the-time-element/" rel="bookmark">The time element (and microformats)</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on February 9, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/the-time-element/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Your Questions Answered #4</title>
		<link>http://html5doctor.com/your-questions-answered-4/</link>
		<comments>http://html5doctor.com/your-questions-answered-4/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 08:52:14 +0000</pubDate>
		<dc:creator>Richard Clark</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Browser Compatibility]]></category>
		<category><![CDATA[WAI-ARIA]]></category>
		<category><![CDATA[aria]]></category>
		<category><![CDATA[details]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[xhtml5]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1242</guid>
		<description><![CDATA[
			
				
			
		
 Here we go with another post rounding up your HTML5 questions and sharing the answers with the world. We cover a wide range of topics this time, inlcluding ARIA, storage, offline capabilities, and document outlines, so read on to find the answers.
We also want to know what areas of HTML5 you&#8217;d like us to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p><img src="http://html5doctor.com/wp-content/uploads/2009/07/html5doctor-treatment.gif" alt="Illustration of a doctor treating a patient" class="alignright size-full wp-image-424" /> Here we go with another post rounding up your <abbr>HTML</abbr>5 questions and sharing the answers with the world. We cover a wide range of topics this time, inlcluding <abbr>ARIA</abbr>, storage, offline capabilities, and document outlines, so read on to find the answers.</p>
<p>We also want to know what areas of <abbr>HTML</abbr>5 you&#8217;d like us to cover in future articles, so <a href="/contact/">let us know</a>!</p>
<h2>Older browsers and <abbr>XHTML</abbr></h2>
<p>Brett Prichard asked:</p>
<blockquote><p>If I were to use one of the new tags in <abbr>HTML</abbr>5, (i.e., <code>&lt;video&gt;</code> or <code>&lt;header&gt;</code>) what would happen when the page is rendered by an older browser?</p>
<p>The other question I have is will there be an <abbr>XHTML</abbr> equivalent? <abbr>XHTML</abbr> 2.0 breaks off compatibility with <abbr>HTML</abbr>s 1-4, but will it be compatible with <abbr>HTML</abbr>5? I prefer to code in <abbr>XHTML</abbr>.</p>
<p>Thank you for reading.</p></blockquote>
<p>To answer your first question: nothing special. The content nested within the element is displayed. (In the case of video, the fallback content is shown.)</p>
<p>Regarding your second question, I wrote about the <a href="/html-5-xml-xhtml-5/"><abbr>XHTML</abbr> serialisation of <abbr>HTML</abbr>5 a while ago</a>.</p>
<p>&mdash; Thanks, Bruce</p>
<h2><abbr>ARIA</abbr></h2>
<p>Joseph Chapman asked:</p>
<blockquote><p>My colleagues and I wish to switch our doctype to the streamlined <code>&lt;!doctype html&gt;</code> and implement several things we learnt from Jeremy Keith last Wednesday, primarily <abbr title="Accessible Rich Internet Applications">ARIA</abbr>. </p>
<p>We know that support is good as long as we add an extra DTD, but we can&#8217;t find the appropriate doctype declaration to stick on the end of <code>...html&gt;</code> Any ideas? We are really keen to kick this off and use a new piece of technology that will help springboard our site to a new level of accessibility. </p>
<p>Any answers appreciated.</p>
<p>Thanks for your help.</p></blockquote>
<p>It&#8217;s okay to add <abbr>ARIA</abbr> to <abbr>HTML</abbr>5 now without using a different doctype. I suggest you give <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#annotations-for-assistive-technology-products-(aria)">this part of the spec</a> a read.</p>
<p>I believe a task force has been created to more closely align <abbr>ARIA</abbr> to <abbr>HTML</abbr>5. We plan to cover <abbr>ARIA</abbr> more in a future post.</p>
<p>Hope this helps</p>
<p>&mdash; Rich </p>
<h2>Attribute Minification</h2>
<p>Nick Leon asked:</p>
<blockquote><p>Hey there HTML5Doctor,</p>
<p>I consider myself a strong <abbr title="Plain Old Semantic HTML">POSH</abbr> developer. One of the requirements for valid <abbr>XHTML</abbr> is that &#8220;attribute minimization&#8221; is not allowed. <abbr>HTML</abbr> permits &#8220;attribute minimization&#8221;, where boolean attributes can have their value omitted entirely, e.g., <code>&lt;option selected&gt;</code>. All XML attributes must have explicit quoted values, so in XML this would be written as <code>&lt;option selected="selected"&gt;</code>.</p>
<p>I was wondering where <abbr>HTML</abbr>5 stands with attribute minimization. I noticed in some of your example code, you provided the minimized form of the attribute, e.g., <code>&lt;audio src="elvis.ogg" controls autobuffer&gt;&lt;/audio&gt;</code>. Is this valid in <abbr>HTML</abbr>5? Would this be the valid version for <abbr>XHTML</abbr>5:</p>
<p><code>&lt;audio src="elvis.ogg" controls="1" autobuffer="0"&gt;&lt;/audio&gt;</code>?</p></blockquote>
<p>Those are both valid <abbr>HTML</abbr>5 structures (however,  controls=&#8221;1&#8243; isn&#8217;t legal; you need to say controls=&#8221;controls&#8221;).</p>
<p>In <abbr>HTML</abbr>5, you can format attributes as you please. In <a href="/html-5-xml-xhtml-5/"><abbr>XHTML</abbr>5 (the <abbr>XML</abbr> serialisation)</a>, you need to obey the <abbr>XML</abbr> rules.</p>
<p>&mdash; Cheers, Bruce</p>
<h2>Offline storage</h2>
<p>Kevin Searle asked:</p>
<blockquote><p>I&#8217;m having a hard time wrapping my head around the offline storage capabilities of the <abbr>HTML</abbr> 5 spec. Can you consider an &#8220;<abbr>HTML</abbr> 5 Offline Storage 101&#8243; article?</p></blockquote>
<p>Just to clarify, do you mean &#8220;storage&#8221; or &#8220;offline&#8221;? They&#8217;re two very different things.</p>
<p>Storage relates to variables, like cookie jars but a lot bigger.</p>
<p>Offline applications are about detecting connectivity and possibly running your app without a connection to the Web.</p>
<p>We (i.e., Remy) will be writing about both of these topics, but it&#8217;s useful to know which is more in demand than the other.</p>
<p>In the meantime, feel free to check out the demos I&#8217;ve written at <a href="http://html5demos.com"><abbr>HTML</abbr>5 Demos</a> (covering offline, storage, and web databases).</p>
<p>&mdash; Remy</p>
<h2>Nav Title (in the document outline)</h2>
<p>D Ross asked:</p>
<blockquote><p>Working on my new site and checked it with the <a href="http://gsnedders.html5.org/outliner/">outliner</a>. I&#8217;m getting an &#8220;untitled section&#8221; showing up because I don&#8217;t have a headline inside my &#8220;nav&#8221; element.</p>
<p>Is this correct? Do I really need to title my main nav?</p>
<p>If so, is adding an <code>&lt;h5&gt;</code> or something similar with the words &#8220;main navigation&#8221; good enough? If so, is hiding it with <code>display: none</code> okay?</p>
<p>Thanks,</p>
<p>DRoss</p></blockquote>
<p>Yes, &#8220;untitled section&#8221; is fine. I know it&#8217;s been suggested to the developer of the outliner that it should say &#8220;navigation&#8221; or something similar, but I&#8217;m not sure when or whether that will happen. (You&#8217;ll see the same thing with <code>&lt;aside&gt;</code> too if there&#8217;s no heading nested directly beneath the element).</p>
<p>Thanks,</p>
<p>&mdash; Rich</p>
<h2>The details element</h2>
<p>Bart asked:</p>
<blockquote><p>Hello Doctors!</p>
<p>I&#8217;d like to ask you a little help with understanding the &#8220;details&#8221; element.</p>
<p>As the W3 spec says: &#8220;The details element represents a disclosure widget from which the user can obtain additional information or controls&#8221;.</p>
<p>I&#8217;m not sure if I get it right, but I think I can use this element to put details about a post (such as date and time) and controls, including &#8220;answer&#8221;, &#8220;save&#8221; and &#8220;repost&#8221;.</p>
<p>Please tell me if I&#8217;m wrong.</p>
<p>Regards, Bart</p>
<p>PS. I love the HTML5doctor blog, it&#8217;s so important to explain how to use <abbr>HTML</abbr>5. Keep up the great work!</p></blockquote>
<p>This question triggered a flurry of responses from several of us doctors, so we&#8217;ve added them all here for you.</p>
<h3>Answer 1</h3>
<p>The spec says <code>&lt;details&gt;</code> is not appropriate for footnotes, and you could argue that post details are footnotes. Also, the <code>&lt;details&gt;</code> element has the option to show or hide its content, which suggests to me that it&#8217;s not appropriate for the post details.</p>
<p>You could possibly use a <code>&lt;section&gt;</code> or a <code>&lt;footer&gt;</code> for the post details, but I&#8217;m not clear on what you mean by &#8220;controls&#8221;. </p>
<p>For the date/time, you can use the <code>&lt;time&gt;</code> element:</p>
<pre><code>&lt;time class="published updated" datetime="2009-09-23"&gt;September 23rd, 2009&lt;/time&gt;</code></pre>
<p>Other doctors might have other opinions, but I hope this helps.</p>
<p>&mdash; Tom</p>
<h3>Answer 2</h3>
<p>Just to follow up on Tom&#8217;s reply: the user viewing your content can <em>control</em> whether or not they see the details.</p>
<p>The <code>&lt;details&gt;</code> element is an interactive element that is collapsed by default, so that only the heading is visible. The heading should be marked up in a <code>&lt;dt&gt;</code> element (if absent, it will read &#8220;Details&#8221;).</p>
<p>The control that the user agent should render (when fully supporting the <code>&lt;details&gt;</code> element) is a small triangular button to the left that, when clicked, toggles the visibility of the element&#8217;s contents.</p>
<p>If the <code>&lt;details&gt;</code> element should be open by default, it should have its <code>open</code> attribute set.</p>
<p>I would use <code>&lt;details&gt;</code> for any content that still allows the surrounding content to make sense while not necessarily needing to be seen. So in your example, I would put the metadata in the <code>&lt;details&gt;</code>, but not the &#8220;user controls&#8221; to reply, save, etc., since the user should always be able to see that they can perform these actions.</p>
<p>While the browser vendors haven&#8217;t implemented the interactive aspect of details, I, for one, will be emulating this using JavaScript.</p>
<p>I hope that helps (too!).</p>
<p>&mdash; Remy</p>
<h3>Answer 3</h3>
<p>You can also use <code>pubdate</code> as an attribute of <code>&lt;time&gt;</code>:</p>
<pre><code>&lt;time pubdate datetime="2009-09-23"&gt;September 23rd, 2009&lt;/time&gt;</code></pre>
<p><code>pubdate</code> is useful when you have two different times in the post. For example, for a future event:</p>
<pre><code>&lt;article&gt;
&lt;header&gt;
&lt;h1&gt;Gig: Hixie and the Pixies, &lt;time datetime="2010-01-01"&gt;Jan 1st 2010&lt;/time&gt;, Royal Albert Hall&lt;/h1&gt;
&lt;p>Published &lt;time datetime="2009-09-21" pubdate&gt;Sept 21, 2009&lt;/time&gt;&lt;/p&gt;
&lt;/header&gt;
&lt;p&gt;With Lachy on kazoo, Henri on Sousaphone, Pilgers on the triangle, and Hixie conducting&lt;/p&gt;
&lt;/article&gt;</code></pre>
<p>I feel a post about the <code>&lt;time&gt;</code> element coming on&hellip;</p>
<p>&mdash; Bruce</p>
<h2>More to come</h2>
<p>That wraps up this round of questions! We&#8217;d like to know what areas of <abbr>HTML</abbr>5 you&#8217;d like us to cover in future articles, so leave a comment below or <a href="http://html5doctor/contact/">send us an e-mail</a>.
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/your-questions-answered-8/" rel="bookmark" class="crp_title">Your Questions Answered #8</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-3/" rel="bookmark" class="crp_title">Your Questions Answered #3</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-9/" rel="bookmark" class="crp_title">Your Questions Answered 9</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-10/" rel="bookmark" class="crp_title">Your Questions Answered #10</a></li>
<li><a href="http://html5doctor.com/absent-elements-and-validation/" rel="bookmark" class="crp_title">Absent Elements and Validation</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=Your%20Questions%20Answered%20%234%20-%20http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;title=Your%20Questions%20Answered%20%234&amp;bodytext=%20Here%20we%20go%20with%20another%20post%20rounding%20up%20your%20HTML5%20questions%20and%20sharing%20the%20answers%20with%20the%20world.%20We%20cover%20a%20wide%20range%20of%20topics%20this%20time%2C%20inlcluding%20ARIA%2C%20storage%2C%20offline%20capabilities%2C%20and%20document%20outlines%2C%20so%20read%20on%20to%20find%20the%20answers.%0D%0A" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;title=Your%20Questions%20Answered%20%234" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;title=Your%20Questions%20Answered%20%234&amp;notes=%20Here%20we%20go%20with%20another%20post%20rounding%20up%20your%20HTML5%20questions%20and%20sharing%20the%20answers%20with%20the%20world.%20We%20cover%20a%20wide%20range%20of%20topics%20this%20time%2C%20inlcluding%20ARIA%2C%20storage%2C%20offline%20capabilities%2C%20and%20document%20outlines%2C%20so%20read%20on%20to%20find%20the%20answers.%0D%0A" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;title=Your%20Questions%20Answered%20%234" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Your%20Questions%20Answered%20%234&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;t=Your%20Questions%20Answered%20%234" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;title=Your%20Questions%20Answered%20%234&amp;annotation=%20Here%20we%20go%20with%20another%20post%20rounding%20up%20your%20HTML5%20questions%20and%20sharing%20the%20answers%20with%20the%20world.%20We%20cover%20a%20wide%20range%20of%20topics%20this%20time%2C%20inlcluding%20ARIA%2C%20storage%2C%20offline%20capabilities%2C%20and%20document%20outlines%2C%20so%20read%20on%20to%20find%20the%20answers.%0D%0A" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Your%20Questions%20Answered%20%234&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;t=Your%20Questions%20Answered%20%234" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;title=Your%20Questions%20Answered%20%234&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=%20Here%20we%20go%20with%20another%20post%20rounding%20up%20your%20HTML5%20questions%20and%20sharing%20the%20answers%20with%20the%20world.%20We%20cover%20a%20wide%20range%20of%20topics%20this%20time%2C%20inlcluding%20ARIA%2C%20storage%2C%20offline%20capabilities%2C%20and%20document%20outlines%2C%20so%20read%20on%20to%20find%20the%20answers.%0D%0A" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;h=Your%20Questions%20Answered%20%234" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fyour-questions-answered-4%2F&amp;t=Your%20Questions%20Answered%20%234&amp;s=%20Here%20we%20go%20with%20another%20post%20rounding%20up%20your%20HTML5%20questions%20and%20sharing%20the%20answers%20with%20the%20world.%20We%20cover%20a%20wide%20range%20of%20topics%20this%20time%2C%20inlcluding%20ARIA%2C%20storage%2C%20offline%20capabilities%2C%20and%20document%20outlines%2C%20so%20read%20on%20to%20find%20the%20answers.%0D%0A" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/your-questions-answered-4/" rel="bookmark">Your Questions Answered #4</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on December 9, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/your-questions-answered-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Absent Elements and Validation</title>
		<link>http://html5doctor.com/absent-elements-and-validation/</link>
		<comments>http://html5doctor.com/absent-elements-and-validation/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 14:30:14 +0000</pubDate>
		<dc:creator>Richard Clark</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Browser Compatibility]]></category>
		<category><![CDATA[Elements]]></category>
		<category><![CDATA[Questions]]></category>
		<category><![CDATA[Validation]]></category>
		<category><![CDATA[WAI-ARIA]]></category>
		<category><![CDATA[doctype]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=777</guid>
		<description><![CDATA[We received the below question from Guy Carberry who was wondering what affect changing the doctype on your <abbr>HTML</abbr> or <abbr>XHTML</abbr> pages to the <abbr>HTML</abbr> 5 doctype will have on those elements that are deprecated current draft.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>We received the below question from Guy Carberry who was wondering what effect changing the doctype on your <abbr>HTML</abbr> or <abbr>XHTML</abbr> pages to the <abbr>HTML</abbr> 5 doctype will have on those elements that are deprecated current draft.</p>
<h2>The Question</h2>
<p>There are several aspects to consider from this question so lets start by taking a look at Guys question in full.</p>
<blockquote><p>
Jeremy Keith says that we can change the Doctype declaration on XHTML 1.0 syntax pages to <cod>&lt;!DOCTYPE html&gt;</code> and it will immediately become HTML 5.</p>
<p>I'm a bit confused about what that means for the Absent and changed elements and attributes info detailed here: <a href="http://www.w3.org/TR/html5-diff/#absent-elements">http://www.w3.org/TR/html5-diff/#absent-elements</a></p>
<p><q>"Some attributes from HTML 4 are no longer allowed in HTML 5. If they need to have any impact on user agents for compatibility reasons it is defined how they should work in those scenarios."</q></p>
<p>So if this is that case, how can you switch the doctype declarations and all be fine?</p>
<p>Thanks for your help,</p>
<p>Guy.
</p></blockquote>
<h2>The Doctors Response</h2>
<p>In answering the question we will need to break the question down into the following:</p>
<ol>
<li>Which elements or attributes are deprecated?</li>
<li>Do I use any of those elements or attributes on my site?</li>
<li>How much do I need to worry about validation?</li>
<li>What effect will this have for backwards compatibility?</li>
<li>Can my content be accessed in all my target browsers and user agents?</li>
</ol>
<p>Lets consider each of these in some more detail below.</p>
<h3>1. Which elements or attributes are deprecated?</h3>
<p>The elements deprecated (from HTML 4.01) from the <abbr>HTML</abbr> 5 specification are: <code>basefont, big, center, font, s, strike, tt, u, frame, frameset, noframes, acronym, applet, isindex, dir</code></p>
<p>You can find a list of those <a href="http://www.w3.org/TR/html5-diff/#absent-elements">elements</a> and <a href="http://www.w3.org/TR/html5-diff/#absent-attributes">attributes</a> along with detailed reasons of why they've been removed by reading <a href="http://www.w3.org/TR/html5-diff"><abbr>HTML<abb> 5 differences from <abbr>HTML</abbr> 5</a>.</p>
<h3>2. Do I use any of those elements or attributes on my site?</h3>
<p>If your site uses any of the above named elements or attributes you may consider changing them to more semantic elements as introduced in <abbr>HTML</abbr> 5. Alternatively you may decide to remove them and use <abbr>CSS</abbr> for presentation in the case of <code>&lt;font&gt;</code> or <code>&lt;center&gt;</code>.</p>
<p>Guy told use that he works for a large university. The site uses a large number of <code>&lt;acronym&gt;</code> tags which have been removed from <abbr>HTML</abbr> 5 as detailed above. To solve this issue for Guy, I feel he has three options if he wishes to make the site: <abbr>HTML</abbr> 5:</p>
<ol>
<li>Change the doctype to <abbr>HTML</abbr> 5 and leave the <code>&lt;acronym&gt;</code> elements in. (Bear in mind the <abbr>HTML</abbr> won't validate)</li>
<li>Change the doctype to <abbr>HTML</abbr> 5 edit the <code>&lt;acronym&gt;</code> elements to become <code>&lt;abbr&gt;</code> elements as advised by the specification</li>
<li>Do nothing and leave the site as <abbr>HTML</abbr> 4.01 or <abbr>XHTML</abbr></li>
</ol>
<p>It's difficult to be able to advise Guy on which option he should choose without knowing the full extent of the effort involved to implement these solutions or knowing the sites goals and project teams views on validation. Speaking of validation, the whole area is a minefield and it's what we'll attempt to cover next.</p>
<h3>3. How much do I need to worry about validation?</h3>
<p>While validation is undoubtedly important for your markup and your <abbr>CSS</abbr>, in my opinion it isn't crucial to a site. Allow me to explain, we recently received a couple of emails pointing out that this site doesn't validate. While there were some errors that have now been corrected, a primary reason why is the use of <abbr title="Accessible Rich Internet Applications">ARIA</abbr> roles in the markup. These attributes currently aren't allowed in the current specification, however there is work underway to make this happen.</p>
<p>To illustrate this point let's look at Google, the search giant. If you look at the source on Google's search pages you'll see they use the <abbr>HTML</abbr> 5 doctype.</p>
<pre><code>&lt;!DOCTYPE html&gt;</code></pre>
<p><aside><q>HTML 5 takes a "pave the cowpaths" approach to development</q></aside></p>
<p>However, those pages don't validate because they use the <code>&lt;font&gt;</code> and <code>&lt;center&gt;</code> elements amongst others things that we already know have been removed from the specification. Does this mean that users stop visiting Google? <em>No</em>.</p>
<p>Remember too that the specification is yet to be finalised and may still be changed (thus breaking you're perfectly valid docments), in partnership with this changes to the specification may not immediately take be implemented in the validators.  We also need to bear in mind that <abbr>HTML</abbr> 5 takes a "pave the cowpaths" approach to development, meaning that the Hixie, et al will look at what authors already do and improve upon it. </p>
<h3>4. What effect will this have for backwards compatibility?</h3>
<p>Leading on from the point about Google as mentioned previously we know Googles site not validating doesn't matter but is it still backwards compatible? <em>Yes</em>. As far as we know, all the browsers support the <code>&lt;font&gt;</code> tag.  It's the validators that don't.  If you want to use an antiquated element you can do, the browser will still handle it - it just won't validate.</p>
<p>In terms of backwards compatibility there is no reason why you couldn't start using new <abbr>HTML</abbr> 5 elements in your <abbr>HTML</abbr> 4.01 or <abbr>XHTML</abbr> 1.x documents, it could even be described as progressive enhancement. For example, why not include the <code>&lt;video&gt;</code> element? It <em>won't</em> validate but maybe that doesn't matter? The browser will still be able to render video, hence <q>"paving the cowpaths"</q>. Having said that if you're going to the effort of including new elements why not go the whole hog and change the doctype too?</p>
<h3>5. Can my content be accessed in all my target browsers and user agents?</h3>
<p>Again to look at Google, it still renders in older browswers and devices but to all intents and purposes it's <abbr>HTML</abbr> 5. Another aspect that the specification defines is that new features should work in or not break in older browsers.</p>
<p><a href="/author/remys/">Remy</a> pointed out in a response to Guy that</p>
<blockquote><p>
Remember that the browser is still going to handle this, regardless of whether <abbr>HTML</abbr> 5 supports this or not. Just like and <abbr>XHTML</abbr> document although doesn't validate with frames, it still renders fine and still supports frames.
</p></blockquote>
<p>So from that we can conclude that browsers will still render deprecated elements or practices. </p>
<h2>Summary</h2>
<p>To wrap up I think we can answer Guys question by saying yes, changing the doctype will make your site <abbr>HTML</abbr> 5, but whether or not it validates is in essence an entirely personal or business decision. Whether this means you are making use of all the benefits of <abbr>HTML</abbr> 5's new elements, javascript API's or offline storage is a whole different subject.
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/html-5-xml-xhtml-5/" rel="bookmark" class="crp_title">HTML 5 + XML = XHTML 5</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-4/" rel="bookmark" class="crp_title">Your Questions Answered #4</a></li>
<li><a href="http://html5doctor.com/html-5-boilerplates/" rel="bookmark" class="crp_title">HTML5 Boilerplates</a></li>
<li><a href="http://html5doctor.com/how-to-use-html5-in-your-client-work-right-now/" rel="bookmark" class="crp_title">How to use HTML5 in your client work right now</a></li>
<li><a href="http://html5doctor.com/your-questions-5/" rel="bookmark" class="crp_title">Your Questions Answered #5</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=Absent%20Elements%20and%20Validation%20-%20http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;title=Absent%20Elements%20and%20Validation&amp;bodytext=We%20received%20the%20below%20question%20from%20Guy%20Carberry%20who%20was%20wondering%20what%20affect%20changing%20the%20doctype%20on%20your%20HTML%20or%20XHTML%20pages%20to%20the%20HTML%205%20doctype%20will%20have%20on%20those%20elements%20that%20are%20deprecated%20current%20draft." title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;title=Absent%20Elements%20and%20Validation" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;title=Absent%20Elements%20and%20Validation&amp;notes=We%20received%20the%20below%20question%20from%20Guy%20Carberry%20who%20was%20wondering%20what%20affect%20changing%20the%20doctype%20on%20your%20HTML%20or%20XHTML%20pages%20to%20the%20HTML%205%20doctype%20will%20have%20on%20those%20elements%20that%20are%20deprecated%20current%20draft." title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;title=Absent%20Elements%20and%20Validation" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Absent%20Elements%20and%20Validation&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;t=Absent%20Elements%20and%20Validation" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;title=Absent%20Elements%20and%20Validation&amp;annotation=We%20received%20the%20below%20question%20from%20Guy%20Carberry%20who%20was%20wondering%20what%20affect%20changing%20the%20doctype%20on%20your%20HTML%20or%20XHTML%20pages%20to%20the%20HTML%205%20doctype%20will%20have%20on%20those%20elements%20that%20are%20deprecated%20current%20draft." title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Absent%20Elements%20and%20Validation&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;t=Absent%20Elements%20and%20Validation" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;title=Absent%20Elements%20and%20Validation&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=We%20received%20the%20below%20question%20from%20Guy%20Carberry%20who%20was%20wondering%20what%20affect%20changing%20the%20doctype%20on%20your%20HTML%20or%20XHTML%20pages%20to%20the%20HTML%205%20doctype%20will%20have%20on%20those%20elements%20that%20are%20deprecated%20current%20draft." title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;h=Absent%20Elements%20and%20Validation" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fabsent-elements-and-validation%2F&amp;t=Absent%20Elements%20and%20Validation&amp;s=We%20received%20the%20below%20question%20from%20Guy%20Carberry%20who%20was%20wondering%20what%20affect%20changing%20the%20doctype%20on%20your%20HTML%20or%20XHTML%20pages%20to%20the%20HTML%205%20doctype%20will%20have%20on%20those%20elements%20that%20are%20deprecated%20current%20draft." title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/absent-elements-and-validation/" rel="bookmark">Absent Elements and Validation</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on August 25, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/absent-elements-and-validation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTML 5 + XML = XHTML 5</title>
		<link>http://html5doctor.com/html-5-xml-xhtml-5/</link>
		<comments>http://html5doctor.com/html-5-xml-xhtml-5/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 14:20:41 +0000</pubDate>
		<dc:creator>Bruce Lawson</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Browser Compatibility]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[XHTML 5]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=381</guid>
		<description><![CDATA[
			
				
			
		
(Also available in Spanish Traducción de “HTML 5 + XML = XHTML 5″ and  Portuguese.)
I like the xhtml syntax. It&#8217;s how I learned. I&#8217;m used to lowercase code, quoted attributes and trailing slashes on elements like br and img. They make me feel nice and comfy, like a cup of Ovaltine and The Evil [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>(Also available in Spanish <a lang="es" href="http://www.htmlcinco.com/traduccion-de-html-5-xml-xhtml-5/">Traducción de “HTML 5 + XML = XHTML 5″</a> and  <a href="http://www.pinceladasdaweb.com.br/blog/2009/12/10/html-5-xml-xhtml-5/">Portuguese</a>.)</p>
<p>I like the <abbr>xhtml</abbr> syntax. It&#8217;s how I learned. I&#8217;m used to lowercase code, quoted attributes and trailing slashes on elements like <code>br</code> and <code>img</code>. They make me feel nice and comfy, like a cup of Ovaltine and <cite>The Evil Dead</cite> on the telly.</p>
<p>But you might not. You might want SHOUTY UPPERCASE tags, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#start-tags">no trailing slashes</a> and <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#attributes">attribute minimisation</a>. And, in <abbr>HTML</abbr> 5, you can choose</a>.</p>
<p>Thanks to the &#8220;<a href="http://www.w3.org/TR/html-design-principles/#pave-the-cowpaths">pave the cowpaths</a>&#8221; principle, it&#8217;s up to you. As you like it. What you will. Whatever you want, whatever you like.</p>
<p>But let no-one tell you that <abbr>HTML</abbr> 5 kills <abbr>XML</abbr>&mdash;meet <abbr>XHTML</abbr> 5.</p>
<p><abbr>XHTML</abbr> 5 is the <abbr>XML</abbr> serialisation of <abbr>HTML</abbr> 5 and, as you&#8217;d imagine, it has all the stricter parsing rules that you&#8217;d expect (and are used to if, like me, you grew up with <abbr>XHTML</abbr> DOCTYPES). It <strong>must</strong> be served  with an XML MIME type, such as application/xml or application/xhtml+xml (so no rendering in Internet Explorer for the moment) and will throw a wobbly at the slightest well-formedness violation. (See  <a href="http://www.webstandards.org/learn/articles/askw3c/sep2003/">Serving XHTML with the Right MIME Type</a> for more information.)</p>
<p>Usual <abbr>XML</abbr> rules apply: no <code>document.write</code>s allowed, no DOCTYPE required,  some syntax and script differences to trip up the unwary and you can use namespaces. </p>
<p>The main differences are summarised on the official <abbr>WHATWG</abbr> wiki <a href="http://wiki.whatwg.org/wiki/HTML_vs._XHTML">Differences Between HTML and XHTML</a>. It&#8217;s also possible to write <a href="http://dev.w3.org/html5/html-author/#polyglot-documents">polyglot documents</a> that can be processed as either by browsers, depending on the MIME type used.</p>
<p>Magne emailed the Doctor to ask &#8220;Is it OK to use HTML5 tags in a page with the XHTML 1.1 doctype? Which one  should  I use, as in, which one is the recommendation now?&#8221;</p>
<p>If you want to use the new features, you need to use <abbr>HTML</abbr> 5 DOCTYPE or <abbr>XHTML</abbr> 5. Given that Internet Explorer cannot process <abbr>XML</abbr>, for pragmatic reasons the Doctor advises <abbr>HTML</abbr> 5.
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/absent-elements-and-validation/" rel="bookmark" class="crp_title">Absent Elements and Validation</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-2/" rel="bookmark" class="crp_title">Your questions answered #2</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-3/" rel="bookmark" class="crp_title">Your Questions Answered #3</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-4/" rel="bookmark" class="crp_title">Your Questions Answered #4</a></li>
<li><a href="http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2/" rel="bookmark" class="crp_title">How to get HTML5 working in IE and Firefox 2</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=HTML%205%20%2B%20XML%20%3D%20XHTML%205%20-%20http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;title=HTML%205%20%2B%20XML%20%3D%20XHTML%205&amp;bodytext=%28Also%20available%20in%20Spanish%20Traducci%C3%B3n%20de%20%E2%80%9CHTML%205%20%2B%20XML%20%3D%20XHTML%205%E2%80%B3%20and%20%20Portuguese.%29%0D%0A%0D%0AI%20like%20the%20xhtml%20syntax.%20It%27s%20how%20I%20learned.%20I%27m%20used%20to%20lowercase%20code%2C%20quoted%20attributes%20and%20trailing%20slashes%20on%20elements%20like%20br%20and%20img.%20They%20make%20me%20feel" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;title=HTML%205%20%2B%20XML%20%3D%20XHTML%205" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;title=HTML%205%20%2B%20XML%20%3D%20XHTML%205&amp;notes=%28Also%20available%20in%20Spanish%20Traducci%C3%B3n%20de%20%E2%80%9CHTML%205%20%2B%20XML%20%3D%20XHTML%205%E2%80%B3%20and%20%20Portuguese.%29%0D%0A%0D%0AI%20like%20the%20xhtml%20syntax.%20It%27s%20how%20I%20learned.%20I%27m%20used%20to%20lowercase%20code%2C%20quoted%20attributes%20and%20trailing%20slashes%20on%20elements%20like%20br%20and%20img.%20They%20make%20me%20feel" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;title=HTML%205%20%2B%20XML%20%3D%20XHTML%205" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=HTML%205%20%2B%20XML%20%3D%20XHTML%205&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;t=HTML%205%20%2B%20XML%20%3D%20XHTML%205" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;title=HTML%205%20%2B%20XML%20%3D%20XHTML%205&amp;annotation=%28Also%20available%20in%20Spanish%20Traducci%C3%B3n%20de%20%E2%80%9CHTML%205%20%2B%20XML%20%3D%20XHTML%205%E2%80%B3%20and%20%20Portuguese.%29%0D%0A%0D%0AI%20like%20the%20xhtml%20syntax.%20It%27s%20how%20I%20learned.%20I%27m%20used%20to%20lowercase%20code%2C%20quoted%20attributes%20and%20trailing%20slashes%20on%20elements%20like%20br%20and%20img.%20They%20make%20me%20feel" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=HTML%205%20%2B%20XML%20%3D%20XHTML%205&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;t=HTML%205%20%2B%20XML%20%3D%20XHTML%205" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;title=HTML%205%20%2B%20XML%20%3D%20XHTML%205&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=%28Also%20available%20in%20Spanish%20Traducci%C3%B3n%20de%20%E2%80%9CHTML%205%20%2B%20XML%20%3D%20XHTML%205%E2%80%B3%20and%20%20Portuguese.%29%0D%0A%0D%0AI%20like%20the%20xhtml%20syntax.%20It%27s%20how%20I%20learned.%20I%27m%20used%20to%20lowercase%20code%2C%20quoted%20attributes%20and%20trailing%20slashes%20on%20elements%20like%20br%20and%20img.%20They%20make%20me%20feel" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;h=HTML%205%20%2B%20XML%20%3D%20XHTML%205" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fhtml-5-xml-xhtml-5%2F&amp;t=HTML%205%20%2B%20XML%20%3D%20XHTML%205&amp;s=%28Also%20available%20in%20Spanish%20Traducci%C3%B3n%20de%20%E2%80%9CHTML%205%20%2B%20XML%20%3D%20XHTML%205%E2%80%B3%20and%20%20Portuguese.%29%0D%0A%0D%0AI%20like%20the%20xhtml%20syntax.%20It%27s%20how%20I%20learned.%20I%27m%20used%20to%20lowercase%20code%2C%20quoted%20attributes%20and%20trailing%20slashes%20on%20elements%20like%20br%20and%20img.%20They%20make%20me%20feel" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/html-5-xml-xhtml-5/" rel="bookmark">HTML 5 + XML = XHTML 5</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on July 2, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/html-5-xml-xhtml-5/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>Designing a blog with html5</title>
		<link>http://html5doctor.com/designing-a-blog-with-html5/</link>
		<comments>http://html5doctor.com/designing-a-blog-with-html5/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 14:00:21 +0000</pubDate>
		<dc:creator>Bruce Lawson</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Elements]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[aside]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[section]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=47</guid>
		<description><![CDATA[
			
				
			
		
Much of HTML 5&#8217;s feature set involves JavaScript APIs that make it easier to develop interactive web pages but there are a slew of new elements that allow you extra semantics in your conventional Web 1.0 pages. In order to investigate these, let&#8217;s look at marking up a blog.
Firstly what we&#8217;ll do is use the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>Much of <abbr>HTML</abbr> 5&#8217;s feature set involves JavaScript <abbr>API</abbr>s that make it easier to develop interactive web pages but there are a slew of new elements that allow you extra semantics in your conventional Web 1.0 pages. In order to investigate these, let&#8217;s look at marking up a blog.</p>
<p>Firstly what we&#8217;ll do is use the <code>header</code>, <code>footer</code>, <code>and nav </code>elements to mark up the broad structure of the page. We&#8217;ll make the blog comments form much smarter by using the new data types and built-in validation available in <abbr>HTML</abbr> 5-aware browsers. </p>
<p>Then we&#8217;ll do some work on the guts of the page, using <abbr>HTML</abbr> 5&#8217;s <code>article</code> elements to better mark up blog posts and comments and show how to use the <code>section</code> elements to better structure accessible hierarchical headings on sites that are <abbr>CMS</abbr>-driven. As blogs are chronologically ordered, we&#8217;ll  see what <abbr>HTML 5</abbr> offers us for representing dates and times.</p>
<p>So take the phone of the hook, and make a cup of tea and we&#8217;ll get started.</p>
<p><section></p>
<h2>Setting the DOCTYPE</h2>
<p><abbr>HTML</abbr> 5, when used as plain <abbr>HTML</abbr> rather than its <abbr>XHTML</abbr> 5 sibling doesn&#8217;t need a DOCTYPE. But all browsers do, otherwise they go into <a href="http://en.wikipedia.org/wiki/Quirks_mode">Quirksmode</a>, which you don&#8217;t want: the collision of <abbr>HTML</abbr> 5 and Quirksmode is like matter and anti-matter meeting, and will cause a negative reality inversion that will make your underwear catch fire. </p>
<p>You&#8217;ve been warned, so at the top of your document, you need the line <code>&lt;!DOCTYPE html&gt;</code>.</p>
<p>Some sites &#8220;use&#8221; <abbr>HTML</abbr> 5, when in actual fact all they&#8217;ve done is take their existing code and change the DOCTYPE. That&#8217;s fine and dandy if you&#8217;ve been using valid, semantic code as <abbr>HTML</abbr> 5 is very similar to valid <abbr>HTML</abbr> 4.01. <a href="http://meyerweb.com/eric/thoughts/2009/01/02/an-event-apart-and-html-5/">Eric Meyer mentions small differences</a> like &#8220;not permitting a value attribute on an image submit&#8221;, and there are a few differences between the languages, summarised in the document <a href="http://dev.w3.org/html5/html4-differences/">HTML 5 differences from HTML 4</a>.</p>
<p>However, I don&#8217;t want simply to  rebadge my existing code, but to use some of the new structural elements now.</p>
<p></section><br />
<section></p>
<h2>Using some new structural elements</h2>
<p>My blog &#8211; like millions of others &#8211; has a header denoted by <code>&lt;div id="header"&gt;</code>, a footer <code>&lt;div id="footer"&gt;</code>, some articles (wrapped by an area called &#8220;content&#8221;, <code>&lt;div id="content"&gt;</code>) and some navigation (wrapped up in an area called &#8220;sidebar&#8221; <code>&lt;div id="sidebar"&gt;</code>). Most sites on the Web have similar constructs, although depending on your choice they might be called &quot;branding&quot; or &quot;info&quot; or &quot;menu&quot;, or you might use the equivalent words in your own language. </p>
<p>Although these all have very different functions within the page, they  use  the same generic <code>div</code> in the markup. as <abbr>HTML 4</abbr> has no other way to code them. <abbr>HTML</abbr> 5 has new elements for distinguishing  these logical areas: <code>header</code>, <code>nav</code>, <code>footer</code> and friends. (There&#8217;s  more on this in an artice by Lachlan Hunt on A List Apart: <a href="http://www.alistapart.com/articles/previewofhtml5">A Preview of <abbr>HTML</abbr> 5</a>.)</p>
<p>The overall aim is to replace this structure:</p>
<p><img src="/wp-content/uploads/2009/06/html5-before1.gif" alt="structure chart before redesign"></p>
<p>with this:</p>
<p><img src="/wp-content/uploads/2009/06/html5-after1.gif" alt="structure chart after redesign"></p>
<p>It&#8217;s a simple matter to change the <abbr>HTML</abbr> <code>div</code>s into the new elements. The only difficulty I had was deciding which element to use to mark up my sidebar, as it also includes a search field and &#8220;colophon&#8221; information as well as site-wide navigation. I decided against the <code>aside</code> element,  as <a href="http://dev.w3.org/html5/spec/Overview.html#the-aside-element">the spec says</a> it &#8220;represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content&#8221;, but it&#8217;s nevertheless <em>content</em> rather than navigation. So I decided to go for the <code>nav</code> element as the closest fit.</p>
<p>I&#8217;ve wrapped the main content in a <code>section</code> element (previously I&#8217;d kept it as a <code>div</code>). <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-section-element"><code>section</code> is defined</a> in the spec</p>
<blockquote cite="http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-section-element"><p>The section element represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a heading, possibly with a footer.</p></blockquote>
<p class="warning"><strong>Please note: I no longer recommend wrapping the whole content area in a <code>section</code> element, and suggest that you use a <code>div</code> element. Read more about <a href="/the-section-element">using section appropriately</a>.</strong></p>
<p>In this case, the &#8220;generic document section&#8221; is that of main content. I&#8217;ve retained an <code>id</code> so that a <a href="http://juicystudio.com/article/skip-links.php">skip links</a> feature will work, although I hope that in the future, assistive technology will offer an automatic way for people to go to the first <code>section</code> or <code>article</code>.</p>
<p>My fellow <abbr>HTML</abbr> 5 doctor, Remy Sharp, also notes  that if you retain the <code>div</code>, Internet Explorer without JavaScript would style the div, but none of the other content, making the site  very hard to read.</p>
<p></section><br />
<section></p>
<h2>New form attributes</h2>
<p>As well as the main structural item on the page, I&#8217;ve added some new attributes on <code>input</code> elements in the comments form.</p>
<p><abbr>HTML</abbr> 5 was designed to reflect what developers actually do rather than to reflect a philosophical purity, and that&#8217;s very clearly manifested in the new attributes which mean the browser takes up much of the work currently done by developers re-inventing validation routines in JavaScript. (Extending forms functionality was <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/introduction.html#history-0">how the <abbr>HTML</abbr> 5 spec began</a>).</p>
<p>So I amended the email input field in the comments to be <code>input type="email"</code> which means that when the user submits the form, an <abbr>HTML</abbr> 5-aware browser will use built-in validation routines to check that it&#8217;s in the correct format, without any JavaScript. Check it out in the current version of <a href="http://www.opera.com/">Opera</a>, as that the only full implementation at the time of writing (June 2009), and note that it also adds a &#8220;mail&#8221; icon in the input field as a cue to the user.</p>
<p>There are similar input validation routines triggered by some of the  new <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-type"><code>input</code> types</a>, such as <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#url-state"><code>url</code></a> (which I use on the field that asks for the user&#8217;s web address), <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#number-state"><code>number</code></a> and <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-pattern"><code>pattern</code></a> which compares the input with an arbitrary regular expression.</p>
<p>Another good example is <code>input type="date"</code>, which pops up a calendar widget/ date picker when the user focusses on the input field. You can <a href="http://people.opera.com/brucel/demo/html5-forms-demo.html">test the date picker</a>, or here&#8217;s a screenshot from Opera 9.6:</p>
<p><img src="/wp-content/uploads/2009/06/html5-form-date.gif" alt="date picker pops up next to input field"></p>
<p>A very useful new attribute I used on both <code>input</code> fields for commenter&#8217;s name and email address, and the comment <code>textarea</code> was <code>type="required"</code> which generates a message on submission if the fields are left blank. Each different localisation of a browser would need to have a different message, and it&#8217;s not (so far) customisable by the developer. </p>
<p><img src="/wp-content/uploads/2009/06/html5-required-feedback.gif" alt="red-bordered browser message 'You have to specify a value'" next to unfilled required field"></p>
<p>The good thing with all this new form fabulousness is it&#8217;s all formed around new attributes on an exisiting element, so people using older browsers just see a plain old <code>input</code> field.</p>
<p>    <section></p>
<h3>A note on screenreaders and <abbr>HTML 5</abbr></h3>
<p>I hope screenreaders are ready for these new interactions; I asked the html 5 group to formally <a href="http://lists.w3.org/Archives/Public/public-html/2007Jul/1249.html">invite screenreader vendors to participate</a> in the specification; to my knowledge, <a href="http://lists.w3.org/Archives/Public/public-html/2008Aug/0795.html">none have done so</a>.</p>
<p>    </section><br />
</section><br />
<section></p>
<h2>Laying out the new elements</h2>
<p>It&#8217;s not too hard to layout the new elements. In all the non-<abbr>IE</abbr> browsers, you can lay out anything using <abbr>CSS</abbr> &#8211; even a <a href="http://people.opera.com/brucel/demo/html5-nonsense-element.html">nonsense element</a>. One gotcha  is that that the current crop of browsers have no &#8220;knowledge&#8221; of these elements, although <a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML_5)">support is improving all the time</a>.</p>
<p>All browsers have default settings for the elements they &#8220;know about&#8221;&mdash;how much padding, margin they element gets, does it display as a block or inline?. (Here&#8217;s a <a href="http://www.w3.org/TR/CSS2/sample.html">sample default stylesheet</a>.) Unless over-ridden by <abbr>CSS</abbr>, these defaults apply. But the browsers don&#8217;t know about <code>header</code>, <code>nav</code> and the like, so have no defaults to apply to them.</p>
<p>I got terrible rendering oddities until I explicitly told the browsers </p>
<pre><code>header, footer, nav, article {display:block;}</code></pre>
<p>    <section></p>
<h3><abbr>IE</abbr> layout</h3>
<p>There&#8217;s one gotcha about styling <abbr>HTML</abbr> 5 pages in <abbr>IE</abbr>: it doesn&#8217;t work. You can force it to quite easily with a JavaScript hack <code>document.createElement('element name')</code>. (Lachlan Hunt gets to the bottom of <a href="http://blog.whatwg.org/supporting-new-elements-in-ie">why IE needs this</a>.)</p>
<p>For your convenience, Remy Sharp has written an <a href="http://remysharp.com/2009/01/07/html5-enabling-script/"><abbr>HTML</abbr> 5 enabling script</a> which I use in the header to conjure all the missing elements into existence all at once.</p>
<p>But let&#8217;s be clear: <strong>this won&#8217;t work if your <abbr>IE</abbr> user doesn&#8217;t have JavaScript turned on</strong>. How much of that&#8217;s a big deal that is for you to decide. Pragmatically, it seems to me that the sites that will benefit the most from HTML 5’s new “Ajax”-style features, such as drag-and-drop, are the sites that currently have no hope of working without JavaScript. </p>
<p>    </section><br />
    <section></p>
<h3>Firefox 2 and Camino 1 layout</h3>
<p>Firefox 2 and Camino 1 both use Gecko 1.9 which has a bug and so gets grumpy if you don&#8217;t serve the page as <abbr>XHTML</abbr>. (Go figure; that&#8217;s almost enough to trigger a negative reality inversion and you know how bad that can be). However, Firefox and Camino users upgrade frequently so Firefox is in version 3, while Camino 2 beta is out, so the problem will soon cease to exist. (Read more at <a href="/how-to-get-html5-working-in-ie-and-firefox-2/">How to get HTML5 working in IE and Firefox 22</a> by Remy Sharp.)</p>
<p>    </section><br />
</section><br />
<section></p>
<h2>What&#8217;s the point of those new structural elements?</h2>
<p>Well, they add semantics to the page. The browser now knows which area of your site is the header or the footer because there are <code>header</code> and <code>footer</code> elements, whereas <code>div</code> might be called &#8220;branding&#8221; and &#8220;legal&#8221;, or even  &#8220;<span lang="fr">en-tete</span>&#8221; and &#8220;<span lang="fr">pied-de-page</span>&#8221; or &#8220;<span lang="de">kopfzeile</span>&#8221; and &#8220;<span lang="de">fusszeile</span>&#8220;.</p>
<p>But <em>so what</em>?</p>
<p>Robin Berjon expressed it beautifully in a <a href="http://www.alistapart.com/comments/semanticsinhtml5?page=2#12">comment on <cite>A List Apart</cite></a>: </p>
<blockquote cite="http://www.alistapart.com/comments/semanticsinhtml5?page=2#12">
<p>Pretty much everyone in the Web community agrees that “semantics are yummy, and will get you cookies”, and that’s probably true. But once you start digging a little bit further, it becomes clear that very few people can actually articulate a reason why. So before we all go another round on this, I have to ask: what’s it you wanna do with them darn semantics?</p>
<p>The general answer is “to repurpose content”. That’s fine on the surface, but you quickly reach a point where you have to ask “repurpose to what?” &hellip; I think <abbr>HTML</abbr> should add only elements that either expose functionality that would be pretty much meaningless otherwise (e.g. <code>canvas</code>) or that provide semantics that help repurpose for Web browsing uses.</p>
</blockquote>
<p>In my view, there are a couple of things I want to do with those semantics. The first is for search engine use; it&#8217;s easy to imagine Messrs Google or Yahoo! giving lower weighting to content in <code>footer</code> elements, or extra weight to content in the <code>header</code>. The second reason is to make the site navigable for people with disabilities. People with learning difficulties might instruct their browser always to put the articles before the navigation, for example. User agents might very well have a keyboard shortcut which jumped straight to the <code>nav</code> for example, or jumped straight past the navigation, in a programmatic implementation of &#8220;<a href="http://juicystudio.com/article/skip-links.php">skip links</a>&#8220;.</p>
<p>Which brings me to&hellip;</p>
<p></section><br />
<section></p>
<h2>Further refining the <abbr>HTML</abbr> 5 structure</h2>
<p><section></p>
<h3>The blog home page</h3>
<p>An interesting thing about a blog homepage is that there are generally the last 5 or so posts, each with a heading, a &quot;body&quot; and data about the post (time, who wrote it, how many comments etc.) and usually a link to another page that has the full blog post (if the homepage just showed an excerpt) and its comments.</p>
<p><abbr>HTML</abbr> 5 has an <a href="http://dev.w3.org/html5/spec/Overview.html#the-article-element"><code>article</code> element</a> which I use to wrap each story: </p>
<blockquote cite="http://dev.w3.org/html5/spec/Overview.html#the-article-element">
<p>The article element represents a section of a page that consists of a composition that forms an independent part of a document, page, or site. This could be a forum post, a magazine or newspaper article, a Web log entry, a user-submitted comment, or any other independent item of content.</p>
</blockquote>
<p>Let&#8217;s look in more detail at the guts of how I mark up each blogpost.</p>
<h3>Anatomy of a blog post</h3>
<p><img src="/wp-content/uploads/2009/06/html5-article-outline.gif" alt="diagram of article structure; explanation follows"></p>
<p>The wrapper is no longer a generic <code>div</code> but an <code>article</code>. Within that is a <code>header</code>, comprising a heading (the title of the blogpost) and then the time of publication,  marked up using the <code>time</code> element.</p>
<p>Then there are the pearls of wit and wisdom that consitute each of my posts, marked up as paragraphs, blockquotes etc., and is pulled unchanged out of the database. Following that is data about the blog post (category, how many comments) marked up as a footer and, in the case of pages that show a single blogpost, there are comments expressing undying admiration and love. Finally, there may be navigation from one article to the next.</p>
<p>    <section></p>
<h4>Data about the article</h4>
<p>Following the content there is some &#8220;metadata&#8221; about the post: what category it&#8217;s in, how many comments there are. I&#8217;ve marked this up as <code>footer</code>.  I previously used <a href="http://www.whatwg.org/specs/web-apps/current-work/#the-aside-element"><code>aside</code></a> which &#8220;represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content&#8221; but decided that it was too much of a stretch; data <em>about</em> a post is intimately related.</p>
<p><a href="http://www.whatwg.org/specs/web-apps/current-work/#the-footer-element"><code>footer</code></a> is a much better fit: &#8220;A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.&#8221; I was initially thrown off-course by the presentational name of the element; my use here isn&#8217;t at the bottom of the page, or even at the bottom of the article, but it certainly seems to fit the bill &#8211; it&#8217;s information about its section, containing author name, links to related documents (comments) and the like. There&#8217;s no reason that you can&#8217;t have more than one <code>footer</code> on page; the spec&#8217;s description says &quot;the footer element represents a footer for the section it applies to&quot; and a page may have any number of sections. The spec also says &quot;Footers don&#8217;t necessarily have to appear at the end of a section, though they usually do.&quot;</p>
<p>    </section><br />
    <section></p>
<h4>Comments</h4>
<p>I&#8217;ve marked up comments as <code>article</code>s, too, as the spec says that an <code>article</code> could be &#8220;a user-submitted comment&#8221;, but nested these inside the parent <code>article</code>. The spec says</p>
<blockquote cite="http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-article-element"><p>When article elements are nested, the inner article elements represent articles that are in principle related to the contents of the outer article. For instance, a Web log entry on a site that accepts user-submitted comments could represent the comments as article elements nested within the article element for the Web log entry.</p></blockquote>
<p>These are headed with the  date and the time of the comment and name of its author&mdash;if you want, you can wrap these in a <code>header</code>, too, but to me it seems like markup for the sake of it.</p>
<p>    </section><br />
    <section></p>
<h4>Times and dates</h4>
<p>Most blogs, news sites and the like provide dates of article publication.</p>
<p>Microformats people, the most vocal advocates of marking up dates and times, believe that  computer-formatted dates are best for people: their <a href="http://microformats.org/wiki/index.php?title=date-design-pattern&#038;diff=37974&#038;oldid=34166">wiki  says</a> &#8220;the ISO8601 YYYY-MM-DD format for dates is the best choice that is the most accurately readable for the most people worldwide, and thus the most accessible as well&#8221;. I don&#8217;t agree (and neither do candidates in my vox pop of non-geeks, my wife, brother and parents). </p>
<p>I do agree with the microformats people that <a href="http://microformats.org/wiki/principles">hidden metadata is not as good as visible, human-readable data</a> and therefore elected not to use the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-article-element"><code>pubdate</code> attribute of <code>article</code></a>.</p>
<p>Therefore I&#8217;ve used the <abbr>HTML</abbr> 5 <code>time</code> element to give a  machine parsable date to computers, while giving people a human-readable date. Blog posts get the date, while comments get the date and time.</p>
<p>The spec is quite hard to understand, in my opinion, but the format you use is 2004-02-28T15:19:21+00:00, where T separates the date and the time, and the + (or a -) is the offset from <a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr>UTC</abbr></a>. Dates on their own don&#8217;t need a timezone; full datetimes do. Oddly, the spec suggests that if you use a time without a date, you don&#8217;t need a timezone either.</p>
<p>There&#8217;s considerable controversy over the time element at the moment. Recently one of the inner circle, <a href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-March/018687.html">Henri Sivonen, wrote</a> that it&#8217;s for marking up future events only and not for timestamping blogs or news items: &#8220;The expected use cases of hCalendar are mainly transferring <i>future</i> event entries from a Web page into an application like iCal.&quot; This seems very silly to me; if there is a <code>time</code> element, why not allow me to mark up any time or date? </p>
<p>The <a href="http://dev.w3.org/html5/spec/Overview.html#the-time-element">spec for <code>time</code></a> does not mention the future event-only restriction: &quot;The time element represents a precise date and/or a time in the proleptic Gregorian calendar&quot; and gives three examples, two of which are about the past and none of which are &quot;future events&quot;. Although the spec doesn&#8217;t (currently) limit use of the element, it does limit format to precise dates in &quot;the proleptic Gregorian calendar&quot;. This means I can mark up an archive page for &quot;all blog posts today&quot; using time, but not &quot;all July 2008 posts&quot; as that&#8217;s not a full YYYY-MM-DD date. Neither can you mark up precise, but ancient dates, so the date of Julius Ceasar&#8217;s assassination, <a href="http://en.wikipedia.org/wiki/Ides_of_March">15 March 44 <abbr>BC</abbr></a> is not compatible.</p>
<p>I don&#8217;t expect this to be resolved. If you think as I do, feel free to <a href="http://www.whatwg.org/mailing-list#specs">mail the Working Group</a> to express your feeling!</p>
<p>    </section><br />
</section></p>
<p>Hopefully, this brief article (geddit?) has given you a quick overview of how to use some of the new semantic elements. Let me know what you think!</p>
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/aside-revisited/" rel="bookmark" class="crp_title">Aside Revisited</a></li>
<li><a href="http://html5doctor.com/native-drag-and-drop/" rel="bookmark" class="crp_title">Native Drag and Drop</a></li>
<li><a href="http://html5doctor.com/the-time-element/" rel="bookmark" class="crp_title">The time element (and microformats)</a></li>
<li><a href="http://html5doctor.com/the-section-element/" rel="bookmark" class="crp_title">The section element</a></li>
<li><a href="http://html5doctor.com/draw-attention-with-mark/" rel="bookmark" class="crp_title">Draw attention with mark</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=Designing%20a%20blog%20with%20html5%20-%20http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;title=Designing%20a%20blog%20with%20html5&amp;bodytext=Much%20of%20HTML%205%27s%20feature%20set%20involves%20JavaScript%20APIs%20that%20make%20it%20easier%20to%20develop%20interactive%20web%20pages%20but%20there%20are%20a%20slew%20of%20new%20elements%20that%20allow%20you%20extra%20semantics%20in%20your%20conventional%20Web%201.0%20pages.%20In%20order%20to%20investigate%20these%2C%20let%27s%20lo" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;title=Designing%20a%20blog%20with%20html5" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;title=Designing%20a%20blog%20with%20html5&amp;notes=Much%20of%20HTML%205%27s%20feature%20set%20involves%20JavaScript%20APIs%20that%20make%20it%20easier%20to%20develop%20interactive%20web%20pages%20but%20there%20are%20a%20slew%20of%20new%20elements%20that%20allow%20you%20extra%20semantics%20in%20your%20conventional%20Web%201.0%20pages.%20In%20order%20to%20investigate%20these%2C%20let%27s%20lo" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;title=Designing%20a%20blog%20with%20html5" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Designing%20a%20blog%20with%20html5&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;t=Designing%20a%20blog%20with%20html5" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;title=Designing%20a%20blog%20with%20html5&amp;annotation=Much%20of%20HTML%205%27s%20feature%20set%20involves%20JavaScript%20APIs%20that%20make%20it%20easier%20to%20develop%20interactive%20web%20pages%20but%20there%20are%20a%20slew%20of%20new%20elements%20that%20allow%20you%20extra%20semantics%20in%20your%20conventional%20Web%201.0%20pages.%20In%20order%20to%20investigate%20these%2C%20let%27s%20lo" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Designing%20a%20blog%20with%20html5&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;t=Designing%20a%20blog%20with%20html5" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;title=Designing%20a%20blog%20with%20html5&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=Much%20of%20HTML%205%27s%20feature%20set%20involves%20JavaScript%20APIs%20that%20make%20it%20easier%20to%20develop%20interactive%20web%20pages%20but%20there%20are%20a%20slew%20of%20new%20elements%20that%20allow%20you%20extra%20semantics%20in%20your%20conventional%20Web%201.0%20pages.%20In%20order%20to%20investigate%20these%2C%20let%27s%20lo" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;h=Designing%20a%20blog%20with%20html5" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fdesigning-a-blog-with-html5%2F&amp;t=Designing%20a%20blog%20with%20html5&amp;s=Much%20of%20HTML%205%27s%20feature%20set%20involves%20JavaScript%20APIs%20that%20make%20it%20easier%20to%20develop%20interactive%20web%20pages%20but%20there%20are%20a%20slew%20of%20new%20elements%20that%20allow%20you%20extra%20semantics%20in%20your%20conventional%20Web%201.0%20pages.%20In%20order%20to%20investigate%20these%2C%20let%27s%20lo" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/designing-a-blog-with-html5/" rel="bookmark">Designing a blog with html5</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on June 30, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/designing-a-blog-with-html5/feed/</wfw:commentRss>
		<slash:comments>140</slash:comments>
		</item>
		<item>
		<title>The video element</title>
		<link>http://html5doctor.com/the-video-element/</link>
		<comments>http://html5doctor.com/the-video-element/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 23:58:46 +0000</pubDate>
		<dc:creator>Tom Leadbetter</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Elements]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=65</guid>
		<description><![CDATA[
			
				
			
		
The &#60;video&#62; element is brand new in HTML 5 and allows you to, get this, play a movie in your website! The data of this element is supposed to be video but it might also have audio or images associated with it.
Of course, this will only work in a few browsers: Safari 3.1+, Firefox 3.5+, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" /><br />
			</a>
		</div>
<p>The &lt;video&gt; element is brand new in HTML 5 and allows you to, get this, play a movie in your website! The data of this element is supposed to be video but it might also have audio or images associated with it.</p>
<p>Of course, this will only work in a few browsers: Safari 3.1+, Firefox 3.5+, and latest builds of Opera (oh, and potentially the next release of Chrome).<span id="more-65"></span></p>
<h2>The ‘old’ way</h2>
<p>Ugh, look at this horrid code:</p>
<pre><code>&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="allowscriptaccess" value="always" /&gt;
&lt;param name="src" value="http://www.youtube.com/v/oHg5SJYRHA0&amp;hl=en&amp;fs=1&amp;" /&gt;
&lt;param name="allowfullscreen" value="true" /&gt;
&lt;embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/oHg5SJYRHA0&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"&gt;
&lt;/embed&gt;
&lt;/object&gt;</code></pre>
<p>Yuck. And as you know, you need Flash for this. Or it is often delivered via javascript as well so it is not perfect.</p>
<h2>The HTML 5 way</h2>
<p>Nice, clean, minimal code:</p>
<pre><code>&lt;video width=&quot;640&quot;  height=&quot;360&quot; src=&quot;http://www.youtube.com/demo/google_main.mp4&quot;  controls autobuffer&gt;
&lt;p&gt; Try this page in Safari  4! Or you can &lt;a  href=&quot;http://www.youtube.com/demo/google_main.mp4&quot;&gt;download the  video&lt;/a&gt; instead.&lt;/p&gt;
  &lt;/video&gt;
</code></pre>
<h3>Autoplay</h3>
<p>The video tag has an attribute that allows the video to play when the page loads.</p>
<pre><code>&lt;video src="abc.mov" autoplay&gt;
&lt;/video&gt;</code></pre>
<p>But <a href="http://www.punkchip.com/2009/04/autoplay-is-bad-for-all-users/">autoplay is bad ok</a>? Youtube and the like autoplay their videos. But before you push the launch button for your HTML 5 site, strongly consider whether it should autoplay a video.</p>
<h3>Download</h3>
<p>If the browser doesn’t know what to do with video tag, or if there is a display error, you can offer a download to the video instead:</p>
<h3>Autobuffer</h3>
<p>Autobuffer attribute is used when autoplay is <strong>not</strong> used but the page/site owner thinks the video will be watched at some point. The video is downloaded in the background, so when the user starts the video, it will be able to play at least some of the content. If both autoplay and autobuffer are used, then autobuffer is ignored.</p>
<p>It is worth pointing out at this point that the browser automatically downloads the video anyway, with or without autobuffer and there is nothing you can do about it. This has bandwidth and loading time issues, particularly if you have a lot of video on your page.</p>
<h3>Poster</h3>
<p>Use the poster attribute to display a frame of the video (as a .jpg, .png, whatever), in case the video doesn’t load for some reason. It can be a local image or elsewhere on the web</p>
<pre><code>&lt;video width="640" height="360" src="http://www.youtube.com/demo/google_main.mp" autobuffer controls poster="whale.png"&gt;
&lt;p&gt;Try this page in Safari 4! Or you can &lt;a href="http://www.youtube.com/demo/google_main.mp4"&gt;download the video&lt;/a&gt; instead.&lt;/p&gt;
&lt;/video&gt;</code></pre>
<p>You should use the poster attribute because you don’t want the user to see nothing.</p>
<h3>Controls</h3>
<p>Adding this attribute means you can use your own play/pause/etc buttons for your video. Safari has lovely default controls but you can create your own.</p>
<h3>Subtitles</h3>
<p>There is no attribute for subtitles (yet – hello HTML 5 group) but just thought I’d mention it. Personally I love the way the JW FLV player handles it, but this is a very interesting read: <a href="http://blog.gingertech.net/2008/12/12/attaching-subtitles-to-html5-video/">http://blog.gingertech.net/2008/12/12/attaching-subtitles-to-html5-video/</a></p>
<p>But ideally, we will be able to delivery subtitles/description audio without javascript.</p>
<h2>Current issues</h2>
<h3>Codecs</h3>
<p>I won’t claim to be a video/audio codec expert but there are a few outstanding issues in this area, which <a href="http://www.topfstedt.de/weblog/?p=382">this article</a> does a good job explaining.</p>
<h3>Internet Explorer</h3>
<p>IE hasn’t a clue and as the market leader, will need to be addressed. Thankfully here at HTML 5 Doctor, we have a few hints and tips for IE that will be coming shortly.</p>
<h3>Physical file</h3>
<p>So far, the video tag needs to link to a physical file (see example at the top). What we need here is a way to just import, say a YouTube video, using the video tag, like we did with the embed tag.</p>
<p>When I set out writing this article, what I wanted to do was kick it back to 2008 and Rickroll the lot of you but so far I haven’t found a way to do it with the video tag.</p>
<p>Here’s what I think you should be able to do with the video tag:</p>
<pre><code>&lt;video src="http://www.youtube.com/v/oHg5SJYRHA0&amp;hl=en&amp;fs=1&amp;" autoplay&gt;
&lt;/video&gt;</code></pre>
<p>How awesome would that be?</p>
<h2>Conclusion</h2>
<p>I think there is a <strong>long</strong> way to go yet but this tag has real potential. The issue over codecs looks certain to run and run, but you can put fall backs in the code, like the download link. You could use a combination of the video, object, embed elements, but that markup will be pretty horrendous:</p>
<pre><code>&lt;video width="640" height="360" src="http://www.youtube.com/demo/google_main.mp4" autobuffer controls poster="whale.png"&gt;
&lt;object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" width="640"height="360" codebase="http://www.apple.com/qtactivex/qtplugin.cab"&gt;
&lt;param value="http://www.youtube.com/demo/google_main.mp4"&gt;
&lt;param value="true"&gt;
&lt;param value="false"&gt;
&lt;embed src="http://www.youtube.com/demo/google_main.mp4" width="640"height="360" autoplay="true" controller="false" pluginspage="http://www.apple.com/quicktime/download/"&gt;
&lt;/embed&gt;
&lt;/object&gt;
&lt;/video&gt;</code></pre>
<h2>In the meantime</h2>
<p>If you don’t want to use the video tag yet, then here is <strong>valid</strong> XHTML code to display a video:</p>
<pre><code>&lt;object width="460" height="265" data="http://vimeo.com/moogaloop.swf?clip_id=5072163" type="application/x-shockwave-flash"&gt;
&lt;param value="http://vimeo.com/moogaloop.swf?clip_id=5072163"&gt;&lt;/param&gt;
&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;
&lt;param value="always"&gt;&lt;/param&gt;
&lt;/object&gt;</code></pre>
<h2>Further reading</h2>
<ul>
<li><a href="http://dev.w3.org/html5/spec/Overview.html#video">Editor&#8217;s Draft 17 June 2009</a></li>
<li><a href="http://www.brucelawson.co.uk/2009/accessibility-of-html5-video-and-audio-elements/">Accessibility of HTML 5 video and audio elements </a></li>
<li><a href="http://www.alobbs.com/1369/Setting_up_a_HTML5_on_line_video_site.html">Setting up a HTML 5 on-line video site</a></li>
<li><a href="http://blog.dailymotion.com/2009/05/27/watch-videowithout-flash/">Watch Video…without Flash</a></li>
<li><a href="http://www.youtube.com/html5">YouTube HTML 5 demo</a></li>
<li><a href="http://henriksjokvist.net/archive/2009/2/using-the-html5-video-tag-with-a-flash-fallback">Using the HTML 5 video tag with a Flash fallback</a></li>
<li><a href="http://www.computedstyle.com/2009/05/lessons-from-building-basic-video.html">Lessons From Building a Basic Video Player in HTML 5</a></li>
</ul>
<div id="crp_related">
<h3>Related Posts:</h3>
<ul>
<li><a href="http://html5doctor.com/video-the-track-element-and-webm-codec/" rel="bookmark" class="crp_title">Video: the track element and webM codec</a></li>
<li><a href="http://html5doctor.com/native-audio-in-the-browser/" rel="bookmark" class="crp_title">Native Audio in the browser</a></li>
<li><a href="http://html5doctor.com/youtube-and-vimeo-support-html5-video/" rel="bookmark" class="crp_title">YouTube and Vimeo support HTML5 Video</a></li>
<li><a href="http://html5doctor.com/your-questions-answered-1/" rel="bookmark" class="crp_title">Your questions answered #1</a></li>
<li><a href="http://html5doctor.com/the-nsfw-element/" rel="bookmark" class="crp_title">The nsfw element</a></li>
</ul>
</div>
<p>Share and Save:</p>
<p>	<a rel="nofollow"  href="http://twitter.com/home?status=The%20video%20element%20-%20http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F" title="Twitter"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;title=The%20video%20element&amp;bodytext=The%20%26lt%3Bvideo%26gt%3B%20element%20is%20brand%20new%20in%20HTML%205%20and%20allows%20you%20to%2C%20get%20this%2C%20play%20a%20movie%20in%20your%20website%21%20The%20data%20of%20this%20element%20is%20supposed%20to%20be%20video%20but%20it%20might%20also%20have%20audio%20or%20images%20associated%20with%20it.%0D%0A%0D%0AOf%20course%2C%20this%20will%20only%20work%20" title="Digg"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F" title="Sphinn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;title=The%20video%20element" title="Reddit"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;title=The%20video%20element&amp;notes=The%20%26lt%3Bvideo%26gt%3B%20element%20is%20brand%20new%20in%20HTML%205%20and%20allows%20you%20to%2C%20get%20this%2C%20play%20a%20movie%20in%20your%20website%21%20The%20data%20of%20this%20element%20is%20supposed%20to%20be%20video%20but%20it%20might%20also%20have%20audio%20or%20images%20associated%20with%20it.%0D%0A%0D%0AOf%20course%2C%20this%20will%20only%20work%20" title="del.icio.us"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;title=The%20video%20element" title="StumbleUpon"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F" title="Technorati"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=The%20video%20element&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F" title="Netvibes"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;t=The%20video%20element" title="Facebook"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;title=The%20video%20element&amp;annotation=The%20%26lt%3Bvideo%26gt%3B%20element%20is%20brand%20new%20in%20HTML%205%20and%20allows%20you%20to%2C%20get%20this%2C%20play%20a%20movie%20in%20your%20website%21%20The%20data%20of%20this%20element%20is%20supposed%20to%20be%20video%20but%20it%20might%20also%20have%20audio%20or%20images%20associated%20with%20it.%0D%0A%0D%0AOf%20course%2C%20this%20will%20only%20work%20" title="Google Bookmarks"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=The%20video%20element&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F" title="FriendFeed"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;t=The%20video%20element" title="HackerNews"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;title=The%20video%20element&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=The%20%26lt%3Bvideo%26gt%3B%20element%20is%20brand%20new%20in%20HTML%205%20and%20allows%20you%20to%2C%20get%20this%2C%20play%20a%20movie%20in%20your%20website%21%20The%20data%20of%20this%20element%20is%20supposed%20to%20be%20video%20but%20it%20might%20also%20have%20audio%20or%20images%20associated%20with%20it.%0D%0A%0D%0AOf%20course%2C%20this%20will%20only%20work%20" title="LinkedIn"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;h=The%20video%20element" title="NewsVine"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fhtml5doctor.com%2Fthe-video-element%2F&amp;t=The%20video%20element&amp;s=The%20%26lt%3Bvideo%26gt%3B%20element%20is%20brand%20new%20in%20HTML%205%20and%20allows%20you%20to%2C%20get%20this%2C%20play%20a%20movie%20in%20your%20website%21%20The%20data%20of%20this%20element%20is%20supposed%20to%20be%20video%20but%20it%20might%20also%20have%20audio%20or%20images%20associated%20with%20it.%0D%0A%0D%0AOf%20course%2C%20this%20will%20only%20work%20" title="Tumblr"><img src="http://html5doctor.com/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
<p><a href="http://html5doctor.com/the-video-element/" rel="bookmark">The video element</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on June 18, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/the-video-element/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
<enclosure url="http://www.youtube.com/demo/google_main.mp4" length="4519255" type="video/mp4" />
		</item>
	</channel>
</rss>
