<?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; Oli Studholme</title>
	<atom:link href="http://html5doctor.com/author/olib/feed/" rel="self" type="application/rss+xml" />
	<link>http://html5doctor.com</link>
	<description>helping you implement HTML5 today</description>
	<lastBuildDate>Thu, 02 Sep 2010 12:43:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Extending HTML5 — Microformats</title>
		<link>http://html5doctor.com/microformats/</link>
		<comments>http://html5doctor.com/microformats/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 13:30:18 +0000</pubDate>
		<dc:creator>Oli Studholme</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[microformats]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=2304</guid>
		<description><![CDATA[HTML5 contains a bunch of new semantic goodness, but sometimes we need more semantics than what’s available. This is the first article in a series looking at various ways to extend HTML5 — first up, microformats.]]></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%2Fmicroformats%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fmicroformats%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
			</a>
		</div><p>While <abbr>HTML</abbr>5 has a bunch of semantic elements, including new ones like <a href="http://html5doctor.com/the-article-element/" title="The article element | HTML5 Doctor"><code>&lt;article&gt;</code></a> and <a href="http://html5doctor.com/nav-element/" title="Semantic navigation with the nav element | HTML5 Doctor"><code>&lt;nav&gt;</code></a>, sometimes there just isn’t an element with the right meaning. What we want are ways to extend what we’ve got, to add <em>extra semantics</em> that are <em>machine-readable</em> — data that a browser, script, or robot can use.</p>

<section id="native-ways">
<h2>Native ways to extend <abbr>HTML</abbr></h2>

<p>There were five fundamental ways we could extend <abbr>HTML</abbr> 4:</p>

<ul>
<li><code>&lt;meta&gt;</code> element</li>
<li><code>class</code> attribute</li>
<li><code>rel</code> attribute</li>
<li><code>rev</code> attribute</li>
<li><code>profile</code> attribute</li>
</ul>

<p>In <abbr>HTML</abbr>5, <code>rev</code> has fallen by the wayside, becoming obsolete since hardly anyone used it correctly, and because it can be replaced by <code>rel</code>. <code>profile</code> is also obsolete, and there is no support for namespaces in <abbr>HTML</abbr>5. However, <code>&lt;meta&gt;</code>, <code>class</code>, and <code>rel</code> <em>are</em> all in <abbr>HTML</abbr>5. In fact, <code>&lt;meta&gt;</code> now has <a href="http://dev.w3.org/html5/spec-author-view/semantics.html#standard-metadata-names" title="4 The elements of HTML &mdash; HTML5 (Edition for Web Authors)">spec-defined <code>name</code>s</a> and a way to <a href="http://wiki.whatwg.org/wiki/MetaExtensions" title="MetaExtensions - WHATWG Wiki">submit new <code>name</code> values</a>, and <code>rel</code> has <a href="http://dev.w3.org/html5/spec-author-view/links.html#linkTypes" title="4.12 Links — HTML5 (Edition for Web Authors)">several new link types</a> defined in the <abbr>HTML</abbr>5 specification and <a href="http://wiki.whatwg.org/wiki/RelExtensions" title="RelExtensions - WHATWG Wiki">a way to submit more</a> too.</p>

<p>Even better, <a href="http://dev.w3.org/html5/spec-author-view/content-models.html#annotations-for-assistive-technology-products-aria" title="3.2.5 Content models — HTML5 (Edition for Web Authors)"><abbr>WAI</abbr>-<abbr>ARIA</abbr>’s <code>role</code> and <code>aria-*</code> attributes are allowed in <abbr>HTML</abbr>5</a>, and <abbr>HTML</abbr>5 validators can check <abbr>HTML</abbr>5+<abbr>ARIA</abbr>. Other new methods of extending <abbr>HTML</abbr>5 include <strong>custom data attributes</strong> (<code>data-*</code>), <strong>microdata</strong>, and <strong><abbr>RDFa</abbr></strong>. Guest doctor <a href="http://chrisbewick.com/" title="Chris Bewick's web design and development blog">Chris Bewick</a> introduced us to <abbr>HTML</abbr>5’s <a href="http://html5doctor.com/html5-custom-data-attributes/" title="HTML5 Custom Data Attributes (data-*) | HTML5 Doctor">new <code>data-*</code> attribute system</a>, which is perfect for adding private custom data for JavaScript, and we’ll no doubt meet microdata and <abbr>RDFa</abbr> sooner or later.</p>

<p>Finally there are <strong>microformats</strong>. As Dr. Bruce touched on microformats in his article on <a href="http://html5doctor.com/the-time-element/" title="The time element (and microformats) | HTML5 Doctor">the <code>&lt;time&gt;</code> element</a>, let’s delve a little deeper into what microformats are and how to use them in HTML5.</p>
</section><!-- /#native-ways -->

<section id="introducing">
<h2>Introducing microformats</h2>

<p><a href="http://microformats.org/wiki/Main_Page" title="Welcome to the microformats wiki! &middot; Microformats Wiki">Microformats</a> are a collection of vocabularies for extending <abbr>HTML</abbr> with additional <em>machine-readable</em> semantics. They are designed for humans first and machines second. This is currently accomplished via agreed-upon <code>class</code>, <code>rel</code>, <code>rev</code> and <code>profile</code> attributes, coding patterns, and nesting.</p>

<p>Being machine readable means a robot or script that understands the microformat vocabulary being used can understand and process the marked-up data. Each microformat defines a specific type of data and is usually based on existing data formats — like <b>vcard</b> (address book data; <a href="http://www.ietf.org/rfc/rfc2426.txt" title="vCard MIME Directory Profile">RFC2426</a>) and <b>icalendar</b> (calendar data; <a href="http://www.ietf.org/rfc/rfc2445.txt" title="Internet Calendaring and Scheduling Core Object Specification (iCalendar)">RFC 2445</a>) — or common coding patterns (‘paving the cowpaths’ of the web).</p>

<p>Despite their humble beginnings, microformats have also been a runaway success, and they're <a href="http://microformats.org/2010/07/08/microformats-org-at-5-hcards-rich-snippets" title="Microformats | weblog | microformats.org at 5: Two Billion Pages With hCards, 94% of Rich Snippets">far more widely deployed</a> than other “big S” <a href="http://en.wikipedia.org/wiki/Semantic_Web" title="Semantic Web - Wikipedia, the free encyclopedia">Semantic web</a> technologies. For example, many services, such as Twitter and Flickr, offer profile information in hCard format by default, so you may already have a microformatted profile even if you’ve never used microformats before.</p>

<section id="uf-specs">
<h3>Microformat specifications</h3>

<p>There are currently 34 microformats specifications (listed below) in varying levels of completion, and you can find out more about them on the <a href="http://microformats.org/wiki/Main_Page" title="Welcome to the microformats wiki! &middot; Microformats Wiki">microformats wiki</a>.</p>

<section id="uf-published">
<h4>Published microformats</h4>

<ul>
<li>Elemental (simple) microformats
<ul>
<li><abbr title="XHTML Friends Network">XFN</abbr> — specify relationships with people<!--(人間関係を表現する)--></li>
<li><abbr title="XHTML Meta Data Profiles">XMDP</abbr> — add metadata profiles<!--(メタデータのプロフィール)--></li>
<li>VoteLinks — indicate agreement or disagreement with, or indifference to, the link’s destination<!--(投票のリンク)--></li>
<li>rel-nofollow — don’t give ‘weight’ to a link (don’t give ‘Google juice’; mainly for search engines)<!--(リンクにランキングの指標として用いないように)--></li>
<li>rel-license — specify license information<!--(コンテンツのライセンス情報)--></li>
<li>rel-tag — add tags<!--(キーワードやテーマのタグ)--></li>
</ul>
</li>
<li>Compound microformats
<ul>
<li>hCard — contact information for people and organisations<!--(人や会社、組織や場所情報)--></li>
<li>hCalendar — time-based information, such as events<!--(カレンダー・イベント情報)--></li>
<li><abbr title="Extensible Open XHTML Outlines">XOXO</abbr> — outlines <!--(アウトラインフォーマット)--></li>
</ul>
</li>
</ul>
</section><!-- /#uf-published -->

<section id="uf-draft">
<h4>Draft microformats</h4>

<ul class="columns">
<li>adr</li>
<li>geo</li>
<li>hAtom</li>
<li>hAudio</li>
<li>hListing</li>
<li>hMedia</li>
<li>hNews</li>
<li>hProduct</li>
<li>hRecipe</li>
<li>hResume</li>
<li>hReview</li>
<li>rel-directory</li>
<li>rel-enclosure</li>
<li>rel-home</li>
<li>rel-payment</li>
<li>robots exclusion</li>
<li><ins datetime="2010-08-18T21:42:52+0900">Species</ins></li>
<li>xFolk</li>
</ul>

<p>Despite being drafts, many of these are in widespread use.</p>
</section><!-- /#uf-draft -->

<section id="uf-patterns">
<h4>Microformat patterns</h4>

<p>These common coding patterns are just best practices that are frequently used in writing plain old semantic <abbr>HTML</abbr> (POSH) to create microformats.</p>

<ul class="column">
<li><code>&lt;abbr&gt;</code> design pattern</li>
<li><code>class</code> design pattern</li>
<li>date design pattern</li>
<li>datetime design pattern</li>
<li>include pattern</li>
<li>value <code>class</code> pattern</li>
<li><code>rel</code> design pattern</li>
</ul>
</section><!-- /#uf-patterns -->

<p>These specifications and patterns cover many common types of data. They’ve been created by a grass-roots organisation of interested people, and anyone is welcome to contribute or even propose a new microformat.</p>
</section><!-- /#uf-specs -->
</section><!-- /#introducing -->

<section id="lightning">
<h2>A lightning introduction to using microformats</h2>

<p>For those of you that haven't used microformats before, I’ll briefly introduce some simple microformats — hopefully so simple you’ll be encouraged to use them right away!</p>

<section id="rel-license">
<h3>Using rel-license for licensing information</h3>

<p>Adding license information is quite a common activity, and while we can add a link to Creative Commons or another license easily enough, someone would have to read it to understand the content’s license:</p>

<pre><code>&lt;small&gt;This article is licensed under a 
  &lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.0/&quot;&gt;
  Creative Commons Attribution Non-commercial Share-alike 
  (By-&lt;abbr&gt;NC&lt;/abbr&gt;-&lt;abbr&gt;SA&lt;/abbr&gt;) license&lt;/a&gt;.
&lt;/small&gt;</code></pre>

<p>If this information was machine-readable, search engines could use it to help consumers searching by license. By using the <code>rel-license</code> microformat to add <code>rel="license"</code> to the license link (indicating it’s the license for the page’s main content), we can do just that:</p>

<figure>
<pre><code>&lt;small&gt;This article is licensed under a 
  &lt;a <mark>rel=&quot;license&quot;</mark> href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.0/&quot;&gt;
  Creative Commons Attribution Non-commercial Share-alike 
  (By-&lt;abbr&gt;NC&lt;/abbr&gt;-&lt;abbr&gt;SA&lt;/abbr&gt;) license&lt;/a&gt;.
&lt;/small&gt;</code></pre>
<blockquote><p><small>This article is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons Attribution Non-commercial Share-alike (By-<abbr>NC</abbr>-<abbr>SA</abbr>) license</a>.</small></p></blockquote>
<figcaption>A rel-license-formatted code sample with an example rendering</figcaption>
</figure>

<p>This may be so easy you don’t even realise you’ve just microformatted the link! In fact, Google already uses this data to allow us to search by license (look in <a href="http://www.google.com/advanced_search" title="Google Advanced Search">advanced search</a>, in the extra options).</p>

<img src="http://html5doctor.com/wp-content/uploads/2010/07/google-license-search.png" alt="Google advanced search options, showing the “Usage rights” pulldown" width="540" height="227" />
</section><!-- /#rel-license -->

<section id="xfn">
<h3>Using XHTML Friends Network (<abbr>XFN</abbr>)</h3>

<p>Maybe we should term this one eXtensible Friends Network instead <img src='http://html5doctor.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  <abbr>XFN</abbr> is a way of specifying your relationship with people — everything from “met” to “sweetheart” — using the <code>rel</code> attribute on a link to their homepage.</p>

<p>There are two main values: (1) <code>rel="contact"</code> (someone you know how to get in touch with), and (2) <code>rel="me"</code>. The <code>rel="me"</code> value allows you to claim ownership of your various websites, including your accounts on social networks. For example, I could have a profile with a link to my Twitter account:</p>

<pre><code>&lt;p&gt;Oli Studholme &mdash; &lt;a href=&quot;http://twitter.com/boblet&quot;&gt;follow me on
  Twitter (@boblet)&lt;/a&gt;&lt;/p&gt;</code></pre>

<p>A person can infer that @boblet is my Twitter username, but by adding <code>rel="me"</code> we can state this relationship in a machine-readable way.</p>

<pre><code>&lt;p&gt;Oli Studholme &mdash; &lt;a <mark>rel=&quot;me&quot;</mark> href=&quot;http://twitter.com/boblet&quot;&gt;follow me on
  Twitter (@boblet)&lt;/a&gt;&lt;/p&gt;</code></pre>

<p>In order to actually work, this would need to be on my personal homepage, with the same homepage added to my Twitter profile. By doing this, a social web app that understands <abbr>XFN</abbr> could confirm @boblet is me, check my friends on Twitter, check if those people are already registered, and then allow me to follow them all with one click — much easier.</p>

<p>For more on this idea, check out <a href="http://gmpg.org/xfn/and/#idconsolidation" title="XFN: Services &amp; Technologies">Identity consolidation and the <abbr>XFN</abbr> <code>rel="me"</code> value</a>, <a href="http://microformats.org/wiki/RelMeAuth" title="RelMeAuth &middot; Microformats Wiki">the RelMeAuth proposal</a> on the microformats wiki, and <a href="http://code.google.com/apis/socialgraph/docs/" title="About the Social Graph - Social Graph API - Google Code">Google’s Social Graph <abbr>API</abbr></a>. It seems <a href="http://tantek.com/2010/191/t1/facebook-distributed-social-web-diso-rel-me-representative-hcard-microformats">Facebook is supporting <code>rel="me"</code></a> too.</p>
</section><!-- /#xfn -->

<p>Rel-license and <abbr>XFN</abbr> are simple <code>rel</code>-based microformats, but even with their simplicity you can see the potential power in this machine-readable stuff. Now let’s look at microformats for contact and event information.</p>

<section id="hcard">
<h3>Using hCard for contact information</h3>

<p>Almost every website has an about page with some contact information:</p>

<pre><code>&lt;p&gt;Oli Studholme &mdash; &lt;a href=&quot;http://oli.jp/&quot;&gt;http://oli.jp&lt;/a&gt;, or 
&lt;a href=&quot;http://twitter.com/boblet&quot;&gt;follow me on Twitter (@boblet)&lt;/a&gt;.&lt;/p&gt;</code></pre>

<p>Unfortunately, adding someone’s contact information to your phone or address book generally involves a lot of copying and pasting. If the data was machine-readable, however, we could use a tool to do that. Let’s add the <a href="http://microformats.org/wiki/hcard" title="hCard 1.0 · Microformats Wiki">hCard</a> microformat to this code snippet.</p>

<figure>
<pre><code>&lt;p <mark>class=&quot;vcard&quot;</mark>&gt;&lt;span <mark>class=&quot;fn&quot;</mark>&gt;Oli Studholme&lt;/span&gt; &mdash; 
&lt;a <mark>class=&quot;url&quot;</mark> href=&quot;http://oli.jp/&quot;&gt;http://oli.jp&lt;/a&gt;, or 
&lt;a <mark>class=&quot;url&quot;</mark> href=&quot;http://twitter.com/boblet&quot;&gt;follow me on Twitter 
(@&lt;span <mark>class=&quot;nickname&quot;</mark>&gt;boblet&lt;/span&gt;)&lt;/a&gt;.&lt;/p&gt;</code></pre>
<blockquote><p class="vcard"><span class="fn">Oli Studholme</span> — <a class="url" href="http://oli.jp/">http://oli.jp</a>, or <a class="url" href="http://twitter.com/boblet">follow me on Twitter (@<span class="nickname">boblet</span>)</a>.</p></blockquote>
<figcaption>An hCard-formatted code sample with an example rendering</figcaption>
</figure>

<p>So we’ve added a bunch of classes. There’s nothing special about that, of course, until you realise they're all part of the hCard microformat. The first one is <code>vcard</code> on the containing <code>&lt;p&gt;</code> element, indicating that there's hCard data here. Then we have <code>fn</code>, which stands for full name, <code>url</code> for an associated homepage, and <code>nickname</code> for, well, a nickname.</p>

<p>This is a simple example, and in fact a valid hCard only requires <code>vcard</code> and <code>fn</code>. But hCard has much more depth. We can mark up all kinds of contact-related data: addresses, company information, even a profile photo. For example, we can explicitly specify a given name and family name (this is essential for Chinese, Korean, Japanese and Vietnamese names), even middle names and titles.</p>

<pre><code>&lt;span <mark>class=&quot;vcard&quot;</mark>&gt;&lt;span <mark>class=&quot;fn n&quot;</mark> lang=&quot;ja&quot;&gt;&lt;span <mark>class=&quot;family-name&quot;</mark>&gt;
スタッドホルム&lt;/span&gt;・&lt;span <mark>class=&quot;given-name&quot;</mark>&gt;オリ&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</code></pre>

<p>The additional <code>n</code> value is actually required, but can be inferred and therefore omitted for names that follow these patterns (the so-called “<a href="http://microformats.org/wiki/hcard#Implied_.22n.22_Optimization" title="hCard 1.0 &middot; Microformats Wiki">implied <code>n</code> optimisation</a>”):</p>
<ul>
<li>given-name family-name</li>
<li>family-name, given-name</li>
</ul>

<p>So what’s the benefit of this? Well, there are several tools that will convert this hCard-microformatted data into a vcard file we can download and automatically add to our address book. Nifty!</p>

<figure>
<img src="http://html5doctor.com/wp-content/uploads/2010/07/operator-hcard.png" alt="The Firefox Operator plugin’s hCard export options" width="370" height="125">
<figcaption>The <a href="https://addons.mozilla.org/firefox/addon/4106">Firefox plugin Operator</a> can save hCard-formatted content as a vcard, or add it to Yahoo Contacts</figcaption>
</figure>

<p>It’s also recognised by <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=99170">Google’s Rich Snippets</a> and <a href="http://developer.yahoo.com/searchmonkey/" title="SearchMonkey - YDN">Yahoo’s SearchMonkey</a>, useful for the contact information on any company website.</p>

<figure>
<img src="http://html5doctor.com/wp-content/uploads/2010/07/google-rich-snippet.png" alt="A preview of how rich snippet data may be incorporated into Google’s search results—in this example “Osaka” and “designer”" width="494" height="175">
<img src="http://html5doctor.com/wp-content/uploads/2010/07/google-rich-snippet-data.png" alt="Microformat hCard data extracted by the Google Rich Snippet testing tool" width="290" height="248">
<figcaption>Google’s Rich Snippet testing tool for an hCard (Note the “Osaka - designer” in the search preview)</figcaption>
</figure>

<section id="hcard-org">
<h4>Organisations, addresses, and phone numbers</h4>

<p>Smaller company websites often have the company name and contact details in the footer, so let’s briefly see how to do that.</p>

<figure>
<pre><code>&lt;p class="vcard"&gt;
&lt;a class="fn org url" href="http://www.w3.org/Consortium/contact-keio" title="Contact Information for W3C/Keio"&gt;&lt;span class="organization-name"&gt;W3C&lt;/span&gt;/&lt;span class="organization-unit"&gt;Keio&lt;/span&gt;&lt;/a&gt;&lt;br&gt;
&lt;span class="adr"&gt;&lt;a class="extended-address" href="http://www.keio.ac.jp/english/about_keio/campus_info/sfc1.html"&gt;Keio University Shonan Fujisawa Campus&lt;/a&gt;&lt;br&gt;
&lt;span class="street-address"&gt;5322 Endo&lt;/span&gt;, &lt;span class="locality"&gt;Fujisawa city&lt;/span&gt;,&lt;br&gt;
&lt;span class="region"&gt;Kanagawa prefecture&lt;/span&gt; &lt;span class="postal-code"&gt;252-8520&lt;/span&gt; &lt;b class="country"&gt;Japan&lt;/b&gt;&lt;br&gt;
&lt;span class="tel"&gt;Telephone: &lt;span class="value"&gt;+81-466-49-1170&lt;/span&gt;&lt;/span&gt;&lt;br&gt;
&lt;span class="tel"&gt;&lt;span class="type"&gt;Fax&lt;/span&gt;: &lt;span class="value"&gt;+81-466-49-1171&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
</code></pre>
<p class="vcard">
<a class="fn org url" href="http://www.w3.org/Consortium/contact-keio" title="Contact Information for W3C/Keio"><span class="organization-name">W3C</span>/<span class="organization-unit">Keio</span></a><br />
<span class="adr"><a class="extended-address" href="http://www.keio.ac.jp/english/about_keio/campus_info/sfc1.html">Keio University Shonan Fujisawa Campus</a><br />
<span class="street-address">5322 Endo</span>, <span class="locality">Fujisawa city</span>,<br />
<span class="region">Kanagawa prefecture</span> <span class="postal-code">252-8520</span> <b class="country">Japan</b><br />
<span class="tel">Telephone: <span class="value">+81-466-49-1170</span></span><br />
<span class="tel"><span class="type">Fax</span>: <span class="value">+81-466-49-1171</span></span></span>
</p>
<figcaption>A microformatted example company hCard, complete with address, and a sample rendering</figcaption>
</figure>

<p>By using <code>fn</code> together with <code>org</code> we can create an hCard for an organisation. Each part of the address is specified (<code>&lt;span&gt;</code>licious!), and we’ve also included a phone number (<code>tel</code>’s default type is voice) and fax number (specifying <code>type</code> and using the value class pattern).</p>

<figure>
<img src="http://html5doctor.com/wp-content/uploads/2010/08/google-rich-snippet2.png" alt="A preview of how rich snippet data may be incorporated into Google’s search results—in this example “Kanagawa Prefecture” and “W3C”" width="475" height="165">
<img src="http://html5doctor.com/wp-content/uploads/2010/08/google-rich-snippet-data2.png" alt="Microformat hCard data extracted by the Google Rich Snippet testing tool" width="415" height="283">
<figcaption>Google’s Rich Snippet testing tool for an organisation hCard (note the address and organisation info in the search preview)</figcaption>
</figure>

<p>And with Operator, we can add this hCard to our computer’s address book in one click. If you’ve ever manually added an address to your address book, you’ll love this <img src='http://html5doctor.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<figure>
<img src="http://html5doctor.com/wp-content/uploads/2010/08/operator-hcard-export.png" alt="Exporting an hCard to your computer’s address book via Operator" width="139" height="85">
<img src="http://html5doctor.com/wp-content/uploads/2010/08/address-book.png" alt="An hCard exported by Operator is automatically added to the address book" width="599" height="340">
<figcaption>Adding hCard-formatted contact information to your address book with one click</figcaption>
</figure>
</section><!-- /#hcard-org -->

</section><!-- /#hcard -->

<section id="hcalendar">
<h3>Using hCalendar for event information</h3>

<p>Let’s briefly look at marking up a simple event. Here’s one I’m involved with:</p>

<pre><code>&lt;h3&gt;&lt;a href=&quot;http://atnd.org/events/5181&quot;&gt;WDE-ex Vol.11 &mdash;
  Designing for iPad: Our experience so far&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;July 21st 19:00-20:00 at 
&lt;a href=&quot;http://www.apple.com/jp/retail/ginza/map/&quot;&gt;Apple Ginza&lt;/a&gt;.&lt;/p&gt;</code></pre>

<p>Just by reading, we understand the event name, date, time, and location. But this information is difficult for computers to extract. By using the hCard microformat, it will be machine-readable.</p>

<figure>
<pre><code>&lt;div <mark>class=&quot;vevent&quot;</mark>&gt;
  &lt;h3&gt;&lt;a <mark>class=&quot;url summary&quot;</mark> href=&quot;http://atnd.org/events/5181&quot;&gt;
  WDE-ex Vol.11 &mdash; Designing for iPad: Our experience so far&lt;/a&gt;&lt;/h3&gt;
  &lt;p&gt;&lt;span <mark>class=&quot;dtstart&quot;</mark>&gt;&lt;abbr <mark>class=&quot;value&quot;</mark> title=&quot;2010-07-21&quot;&gt;
  July 21st&lt;/abbr&gt; &lt;span <mark>class=&quot;value&quot;</mark>&gt;19:00&lt;/span&gt;&lt;/span&gt;-
  &lt;span <mark>class=&quot;dtend&quot;</mark>&gt;&lt;span <mark>class=&quot;value&quot;</mark>&gt;20:00&lt;/span&gt;&lt;/span&gt; at 
  &lt;a <mark>class=&quot;location url&quot;</mark> href=&quot;http://www.apple.com/jp/retail/ginza/map/&quot;&gt;
  Apple Ginza&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</code></pre>
<blockquote><div class="vevent">
  <h3><a class="url summary" href="http://atnd.org/events/5181">WDE-ex Vol.11 — Designing for iPad</a>: Our experience so far</h3>
  <p><span class="dtstart"><abbr class="value" title="2010-07-21">July 21st</abbr> <span class="value">19:00</span></span>-<span class="dtend"><span class="value">20:00</span></span> at <a class="location url" href="http://www.apple.com/jp/retail/ginza/map/">Apple Ginza</a></p>
</div></blockquote>
<figcaption>Example hCard-formatted event, including a sample rendering</figcaption>
</figure>

<p>We’ve added <code>vevent</code> on a wrapping element to indicate this is an hCalendar. Events are required to have a summary and a starting time, so we’ve added <code>summary</code> and indicated the starting date and time using <code>dtstart</code>. While historically datetimes were indicated using <code>&lt;abbr title=""&gt;</code>, the required <a href="http://microformats.org/wiki/iso-8601" title="iso-8601 · Microformats Wiki">ISO 8601 format</a> (for example “<code>2010-07-10T19:01:29</code>”) is very unfriendly to screen readers. Imagine having those numbers read to you! For this reason, the <a href="http://microformats.org/wiki/hcalendar" title="hCalendar 1.0 · Microformats Wiki">hCalendar specification</a> recommends either breaking the datetime into separate date and time pieces, using the <a href="http://microformats.org/wiki/value-class-pattern" title="Value Class Pattern &middot; Microformats Wiki">value class pattern</a>, or possibly doing both. The specification is also smart enough to know that if the end datetime <code>dtend</code> is only a time, then it’s on the same day, so we don’t need to specify the date again, although tool support for this is spotty. Finally, we’ve added some <abbr>URL</abbr>s, one of which is for the event’s location.</p>

<figure>
<img src="http://html5doctor.com/wp-content/uploads/2010/07/operator-hcalendar-debug.png" alt="The Firefox Operator plugin’s debug window, showing information about the current hCalendar" width="383" height="238">
<figcaption>The Firefox plugin Operator’s debug view, showing the microformat properties it has recognised</figcaption>
</figure>

<p>With this data now being machine-readable, we can <em>do things</em> with it. For example, we can add the event to a calendar app with one click.</p>

<figure>
<img src="http://html5doctor.com/wp-content/uploads/2010/07/operator-hcalendar.png" alt="The Firefox Operator plugin’s options for hCalendar-formatted content" width="541" height="172">
<figcaption>Operator can save hCalendar-formatted content as an ical file (for easy importing into your address book software), or add it to various online calendars</figcaption>
</figure>
</section><!-- /#hcalendar -->
</section><!-- /#lightning -->

<section id="uf-in-html5">
<h2>Using microformats in <abbr>HTML</abbr>5</h2>

<p>So now we’ve had a whistle-stop introduction to microformats and gotten a glimpse of the benefits they provide. The question is: Can we use them in <abbr>HTML</abbr>5 pages? Let’s start with the good news.</p>

<p>As most microformats use only <code>class</code> and/or <code>rel</code> — basic parts of <abbr>HTML</abbr> that remain unchanged in HTML5 — <strong>these microformats are completely fine in <abbr>HTML</abbr>5</strong>. Yay! However there are a few wrinkles to keep us on our toes.</p>

<section id="votelinks">
<h3>The <code>rev</code>-based VoteLinks microformat</h3>

<p>One of the things that’s been cut in <abbr>HTML</abbr>5 is the <code>rev</code> attribute, which was the reverse relationship of <code>rel</code>. On the question of whether microformats should use <code>rev</code>, the <a href="http://microformats.org/wiki/rev#Should_rev_even_be_used" title="rel-faq · Microformats Wiki">microformats wiki</a> states:</p>

<blockquote><p>The short answer is unfortunately “NO”. Use of “rev” should be avoided. However, VoteLinks’ use of rev has been grandfathered since it was such an early use.</p>
<footer><cite><a href="http://microformats.org/wiki/rev#Should_rev_even_be_used" title="rel-faq · Microformats Wiki">Rel <abbr>FAQ</abbr> — Microformats wiki</a></cite></footer></blockquote>

<p>The <a href="http://microformats.org/wiki/vote-links" title="Vote Links · Microformats Wiki">VoteLinks specification</a> mentioned here allowed us to add <code>vote-for</code>, <code>vote-against</code>, or <code>vote-abstain</code> values to a link via the <code>rev</code> attribute, indicating agreement, disagreement, or indifference (respectively) toward the destination <abbr>URL</abbr>. However, as the default state of a link is an implicit vote of agreement, and as the rel-nofollow link microformat is equivalent to <code>vote-abstain</code>, the only one we’re unable to replicate is <code>vote-against</code> (no link? <img src='http://html5doctor.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ). I expect that the microformats community will eventually come up with <code>rel</code>-based equivalent names for VoteLinks, but until then you’ll need to avoid this microformat when using <abbr>HTML</abbr>5.</p>
</section><!-- /#votelinks -->


<section id="profile">
<h3>The <code>profile</code> attribute</h3>

<p>The <code>profile</code> attribute is obsolete in <abbr>HTML</abbr>5, as it was determined unnecessary. Currently, microformat profiles are very rarely used in the wild and are not required, so this probably won’t affect you.</p>
<!-- 
Ian Hickson wrote:
Summary: profile="" doesn't work in practice so we have dropped it. We haven't replaced it with anything since there isn't really a problem to solve - conflicts don't occur in practice, as Microformat names are picked to be rather unique and recognisable. The market takes care of problems like this without the need for namespace syntax.
—WHATWG email list, Wed, May 7, 2008 at 11:27 PM
-->
</section><!-- /#profile -->

<section id="uf-specs">
<h3>Microformats specifications vs <abbr>HTML</abbr>5</h3>

<p>While microformats using <code>class</code> and <code>rel</code> work fine, some of the new features in <abbr>HTML</abbr>5 aren’t supported yet. The <a href="http://microformats.org/wiki/html5" title="Microformats in HTML 5 · Microformats Wiki">Microformats in <abbr>HTML</abbr>5</a> page on the microformats wiki currently begins:</p>

<blockquote><p>This page is to document <strong>future</strong> use of microformats in <abbr>HTML</abbr> 5. None of the items documented are supported now, and may change upon proper development within the microformats community, or changes in the <abbr>HTML</abbr> 5 specification.</p>
<footer><cite><a href="http://microformats.org/wiki/html5" title="Microformats in HTML 5 · Microformats Wiki">Microformats in <abbr>HTML</abbr>5 — Microformats wiki</a></cite></footer></blockquote>

<p>This includes the <a href="http://html5doctor.com/the-time-element/" title="The time element (and microformats) | HTML5 Doctor">nifty new <code>&lt;time datetime=""&gt;</code> element</a>, which would be perfect for microformat times, such as <code>dtstart</code> and <code>dtend</code> in the hCalendar microformat. It’s also true for adding microformats via microdata rather than <code>class</code> and <code>rel</code>. There has been talk of a general way to map any microformat into microdata, but this hasn’t eventuated as of yet.</p>
</section><!-- /#uf-specs -->

<section id="uf-tools">
<h3>Microformats-consuming tools (or, the problem with <abbr>HTML</abbr> Tidy)</h3>

<p>The microformats wiki’s warning about <code>&lt;time&gt;</code> brings us to another caveat: tool support. Even if <code>&lt;time datetime=""&gt;</code> was valid in the microformats spec, at present none of the microformats tools know to get this information from the <code>datetime=""</code> attribute. Now, you <em>could</em> wrap <code>&lt;time datetime=""&gt;</code> around a microformats <code>dtstart</code> or <code>dtend</code>:</p>

<pre><code>&lt;time datetime=&quot;2010-07-21T19:00:00+09:00&quot;&gt;&lt;span class=&quot;dtstart&quot;&gt;
  &lt;abbr class=&quot;value&quot; title=&quot;2010-07-21&quot;&gt;July 21st&lt;/abbr&gt;
  &lt;span class=&quot;value&quot;&gt;19:00
&lt;/span&gt;&lt;/span&gt;&lt;/time&gt;</code></pre>

<p>However, as the <code>&lt;time datetime=""&gt;</code> data is then not explicitly part of the microformat, doing this isn’t really getting you anywhere, except bloated code-ville.</p>

<aside class="sidenote"><p>This is because H2VX uses <a href="http://tidy.sourceforge.net/" title="HTML Tidy Project Page"><abbr>HTML</abbr> Tidy</a> (“last updated March 2009”!), which <a href="http://lists.w3.org/Archives/Public/html-tidy/2010JanMar/0005.html" title="Re: teach tidy new attributes ?? from Bjoern Hoehrmann on 2010-02-02 (html-tidy@w3.org from January to March 2010)">probably won’t be fixed for new <abbr>HTML</abbr>5 elements</a>. H2VX’s maintainer considers the potential alternative <a href="http://code.google.com/p/html5lib/" title="html5lib - Project Hosting on Google Code">html5lib.php</a> to be immature for now.</p></aside>

<p>Worse, <a href="http://h2vx.com/" title="H2VX">H2VX.com</a> — a handy microformats tool allowing you to convert hCard and hCalendar microformats into vcard and ical files for users to add to their address books and calendars, respectively — doesn’t see microformat class names on <em>any</em> new <abbr>HTML</abbr>5 elements. That means while we can use <abbr>HTML</abbr> 4-based microformats code in <abbr>HTML</abbr>5 with no problems, <em>if we want to use H2VX</em> we’ll have to add microformats classes to wrapping elements from <abbr>HTML</abbr> 4 (such as <code>&lt;div&gt;</code>s and <code>&lt;span&gt;</code>s), and not on any new <abbr>HTML</abbr>5 elements. For example, in the code snippet above, you can’t add <code>class="dtstart"</code> to <code>&lt;time&gt;</code> to remove the wrapping <code>&lt;span class="dtstart"&gt;</code>, as then H2VX wouldn’t see <code>dtstart</code>.</p>

<section id="uf-tools-table">
<h4>Microformats Tool support</h4>
<table>
<thead><tr><th></th><th><a href="https://addons.mozilla.org/en-US/firefox/addon/4106/">Operator</a></th><th><a href="http://microformatique.com/optimus/" title="Optimus—Microformats Transformer">Optimus</a></th><th><a href="http://h2vx.com/" title="H2VX">H2VX</a></th></tr></thead>
<tbody>
<tr><th>can use classes on <abbr>HTML</abbr>5 elements</th><td>yes</td><td>yes<!-- todo: re-check --></td><td>no</td></tr>
<tr><th>supports <abbr>HTML</abbr>5’s <code>&lt;time&gt;</code></th><td>no</td><td>no</td><td>no</td></tr>
<tr><th>adding <code>&lt;time&gt;</code> as a wrapper</th><td>ok</td><td>ok</td><td>ok</td></tr>
<tr><th>Understands the value class pattern</th><td>yes</td><td>no</td><td>yes</td></tr>
<tr><th>Understands implied <code>dtend</code></th><td>yes</td><td>no</td><td>no</td></tr>
<tr><th>Understands timezones</th><td>yes</td><td>yes</td><td>no</td></tr>
</tbody>
</table>

<p>Until <code>&lt;time&gt;</code> is part of a microformat specification, I don’t expect anyone will support it. However given how &hellip; <em>non-micro</em> expressing datetimes is in microformats currently, I hope they do soon!</p>
</section> <!-- /#uf-tools-table -->
</section> <!-- /#uf-tools -->

</section> <!-- /#uf-in-html5 -->

<section id="conclusion">
<h2>Conclusion</h2>

<p>So where does that leave us? Well, if you keep the above caveats in mind <strong>you can safely use microformats in <abbr>HTML</abbr>5</strong>. Google has no problem with microformats in <abbr>HTML</abbr>5, even on new elements, and I’m under the impression that Yahoo is the same. However, remember that <em>if</em> you want to offer a “click to download” link via H2VX, you’ll have to avoid adding hCard and hCalendar microformat classes to new <abbr>HTML</abbr>5 elements. This will probably involve some extra wrapping <code>&lt;div&gt;</code> or <code>&lt;span&gt;</code> elements, but that’s standard operating procedure for microformats anyhow.</p>

<p id="controversy">An important thing to note about microformats: as wonderful as they are, the current method of using the plain old semantic <abbr>HTML</abbr> tools of <code>class</code>, <code>rel</code>, and coding patterns is something of a brilliant hack. The use of <code>class</code> (an <span title="arbitrary HTML extension point for authors">author playground</span>) and the lack of use/demise of <code>profile</code>, combined with the complexity of coding to detect for microformats in the wild, means that native browser support is unlikely anytime soon<!-- another possible reason is that no browser makers care enough to implement support -->. There was the expectation that at some stage there’d be a better way to easily add extra semantic information for others to use. In future articles, we’ll look at microdata and <abbr>RDFa</abbr>, and see what they have to offer over plain old semantic <abbr>HTML</abbr>.</p>

<p>Despite this, if you have common types of data in your content that are covered by a microformat, and you want to make them machine-readable for others (and who wouldn’t), you should definitely consider using microformats in <abbr>HTML</abbr>5. Adding microformats is basically adding a lightweight <abbr>API</abbr> to your content, and is simple enough that <em>even a designer</em> can do it! This helps search engines and savvy users to more easily use your content. Check out the <a href="http://microformats.org/wiki/" title="Welcome to the microformats wiki! · Microformats Wiki">microformats wiki</a>, grab the indispensable <a href="http://suda.co.uk/projects/microformats/cheatsheet/" title="suda.co.uk/projects/microformats [Cheat Sheet]">microformats cheat sheet</a> by <a href="http://twitter.com/briansuda" title="@briansuda">Brian Suda</a>, peruse these books and DVDs on microformats, and start getting (even more) semantic!</p>

<section id="ref">
<h3>Books and DVDs</h3>
<ul class="amazon">
<li><img src="http://html5doctor.com/wp-content/uploads/2010/08/microformats_ja.jpg" alt="Microformats: Empoering your markup" width="50" height="75" />Microformats: Empowering Your Markup for Web 2.0 — John Allsopp<br />
<div class="amzshcs" id="amzshcs-8a874135a3ce872dc17872b6e19a8bb8"><span class="amzshcs-item" id="amzshcs-item-ca3b214c4f8566611bd6690219fa2a2b"> <a href="http://www.amazon.co.uk/Microformats-Empowering-Your-Markup-Web/dp/1590598148%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1590598148">Amazon UK</a></span></div> | <div class="amzshcs" id="amzshcs-5055b9f29c7cba51ba1714e0f05b3fc9"><span class="amzshcs-item" id="amzshcs-item-adc0339bcd4414e99f890aa52e5b13d7"> <a href="http://www.amazon.com/Microformats-Empowering-Your-Markup-Web/dp/1590598148%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1590598148">Amazon US</a> </span></div> | <div class="amzshcs" id="amzshcs-b574af46f845bc576c4028e3d20910d3"><span class="amzshcs-item" id="amzshcs-item-6a0697ac150924872e2d35f2e763a0c3"> <a href="http://www.amazon.de/Microformats-Empowering-Your-Markup-Web/dp/1590598148%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1590598148">Amazon DE</a> </span></div> | <div class="amzshcs" id="amzshcs-b9418b3f4b0ca6700027f76f19a2f2da"><span class="amzshcs-item" id="amzshcs-item-3ba74a4b213b831047f748be6bc8e4d6"> <a href="http://www.amazon.co.jp/Microformats-Empowering-Your-Markup-Web/dp/1590598148%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1590598148">Amazon JP</a> </span></div> | <div class="amzshcs" id="amzshcs-8ca2f799ff27ab30f84242cf8d7d646c"><span class="amzshcs-item" id="amzshcs-item-edefeeefe744fbb240365caa2f62be2b"> <a href="http://www.amazon.co.jp/%E3%83%9E%E3%82%A4%E3%82%AF%E3%83%AD%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88-%7EWeb%E3%83%9A%E3%83%BC%E3%82%B8%E3%82%92%E3%82%88%E3%82%8A%E4%BE%BF%E5%88%A9%E3%81%AB%E3%81%99%E3%82%8B%E6%9C%80%E6%96%B0%E3%83%9E%E3%83%BC%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97%E3%83%86%E3%82%AF%E3%83%8B%E3%83%83%E3%82%AF%7E-Web-Designing-BOOKS/dp/4839925445%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4839925445">Amazon JP (日本語版)</a> </span></div></li>
<li><img src="http://html5doctor.com/wp-content/uploads/2010/08/microformats_ac.jpg" alt="Designning with Microformats" width="50" height="75" />Designing with Microformats for a Beautiful Web (DVD) — Andy Clarke<br />
<div class="amzshcs" id="amzshcs-95f1b9b80bde174f6f9c9d7ee9f9d59e"><span class="amzshcs-item" id="amzshcs-item-554c5b0c2e314aba0ce5f9a303a79773"> <a href="http://www.amazon.co.uk/DESIGNING-MICROFORMATS-BEAUTIFUL-WEB/dp/0321680146%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321680146">Amazon UK</a> </span></div> | <div class="amzshcs" id="amzshcs-efcffcf308e8a6c623ce78e4bc7f7cd6"><span class="amzshcs-item" id="amzshcs-item-a7fc05944786e81d5d79eed14e4ac61d"> <a href="http://www.amazon.com/Designing-Microformats-Beautiful-Andy-Clarke/dp/0321680146%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321680146">Amazon US</a> </span></div> | <div class="amzshcs" id="amzshcs-d0ce2f4154e95bfae6274f8a6897b158"><span class="amzshcs-item" id="amzshcs-item-33522c588d14e9934a0d834285ae380a"> <a href="http://www.amazon.de/Designing-Microform-Ats-Beautiful-Book/dp/0321680146%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321680146">Amazon DE</a> </span></div> | <div class="amzshcs" id="amzshcs-32b039997ba527fbd9157def627f4dd5"><span class="amzshcs-item" id="amzshcs-item-9468700ba7f9e93e03416265f7ff3cec"> <a href="http://www.amazon.co.jp/Designing-Microformats-Beautiful-Voices-Matter/dp/0321680146%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321680146">Amazon JP</a> </span></div></li>
<li><img src="http://html5doctor.com/wp-content/uploads/2010/08/microformats_el.jpg" alt="Microformats Made Simple" width="50" height="75" /> Microformats Made Simple — Emily P. Lewis and Tantek Celik<br />
<div class="amzshcs" id="amzshcs-09639a7f48fb10d8f851ab7d3e86be26"><span class="amzshcs-item" id="amzshcs-item-0fe33ff215f833e24d23fdbd33512644"> <a href="http://www.amazon.co.uk/Microformats-Made-Simple-Emily-Lewis/dp/0321660773%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321660773">Amazon UK</a> </span></div> | <div class="amzshcs" id="amzshcs-b9a1200a9484c14ac7b0205999c2af7d"><span class="amzshcs-item" id="amzshcs-item-91c60b321652ee65e6b68ea1bbed534f"> <a href="http://www.amazon.co.uk/Microformats-Made-Simple-Emily-Lewis/dp/0321660773%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321660773">Amazon US</a> </span></div> | <div class="amzshcs" id="amzshcs-bf7926010bfcfb17c6d7ef8f864b817b"><span class="amzshcs-item" id="amzshcs-item-540e55e65c683a64f6376981f34766a6"> <a href="http://www.amazon.de/Microformats-Made-Simple-Emily-Lewis/dp/0321660773%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321660773">Amazon DE</a> </span></div> | <div class="amzshcs" id="amzshcs-99d06a2264916bda2ba2341b25df7ca1"><span class="amzshcs-item" id="amzshcs-item-e8ae9d804c21a13653d24d727ff5de1d"> <a href="http://www.amazon.co.jp/Microformats-Made-Simple-Emily-Lewis/dp/0321660773%3FSubscriptionId%3DAKIAIFYRWAKK7IFCGGSQ%26tag%3Dhtml5doctor-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321660773">Amazon JP</a> </span></div></li>
</ul>
</section> <!-- /#ref -->
</section> <!-- /#conclusion --><div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/the-address-element/" rel="bookmark" class="crp_title">The Address Element</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/speaking/" rel="bookmark" class="crp_title">HTML5 Doctor Speaking and Training Appearances</a></li><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/the-figure-figcaption-elements/" rel="bookmark" class="crp_title">The figure &#038; figcaption elements</a></li></ul></div>


Share and Save:


	<a rel="nofollow"  href="http://twitter.com/home?status=Extending%20HTML5%20%E2%80%94%20Microformats%20-%20http%3A%2F%2Fhtml5doctor.com%2Fmicroformats%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%2Fmicroformats%2F&amp;title=Extending%20HTML5%20%E2%80%94%20Microformats&amp;bodytext=HTML5%20contains%20a%20bunch%20of%20new%20semantic%20goodness%2C%20but%20sometimes%20we%20need%20more%20semantics%20than%20what%E2%80%99s%20available.%20This%20is%20the%20first%20article%20in%20a%20series%20looking%20at%20various%20ways%20to%20extend%20HTML5%20%E2%80%94%20first%20up%2C%20microformats." 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%2Fmicroformats%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%2Fmicroformats%2F&amp;title=Extending%20HTML5%20%E2%80%94%20Microformats" 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%2Fmicroformats%2F&amp;title=Extending%20HTML5%20%E2%80%94%20Microformats&amp;notes=HTML5%20contains%20a%20bunch%20of%20new%20semantic%20goodness%2C%20but%20sometimes%20we%20need%20more%20semantics%20than%20what%E2%80%99s%20available.%20This%20is%20the%20first%20article%20in%20a%20series%20looking%20at%20various%20ways%20to%20extend%20HTML5%20%E2%80%94%20first%20up%2C%20microformats." 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%2Fmicroformats%2F&amp;title=Extending%20HTML5%20%E2%80%94%20Microformats" 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%2Fmicroformats%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=Extending%20HTML5%20%E2%80%94%20Microformats&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fmicroformats%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%2Fmicroformats%2F&amp;t=Extending%20HTML5%20%E2%80%94%20Microformats" 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%2Fmicroformats%2F&amp;title=Extending%20HTML5%20%E2%80%94%20Microformats&amp;annotation=HTML5%20contains%20a%20bunch%20of%20new%20semantic%20goodness%2C%20but%20sometimes%20we%20need%20more%20semantics%20than%20what%E2%80%99s%20available.%20This%20is%20the%20first%20article%20in%20a%20series%20looking%20at%20various%20ways%20to%20extend%20HTML5%20%E2%80%94%20first%20up%2C%20microformats." 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=Extending%20HTML5%20%E2%80%94%20Microformats&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fmicroformats%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%2Fmicroformats%2F&amp;t=Extending%20HTML5%20%E2%80%94%20Microformats" 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%2Fmicroformats%2F&amp;title=Extending%20HTML5%20%E2%80%94%20Microformats&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=HTML5%20contains%20a%20bunch%20of%20new%20semantic%20goodness%2C%20but%20sometimes%20we%20need%20more%20semantics%20than%20what%E2%80%99s%20available.%20This%20is%20the%20first%20article%20in%20a%20series%20looking%20at%20various%20ways%20to%20extend%20HTML5%20%E2%80%94%20first%20up%2C%20microformats." 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%2Fmicroformats%2F&amp;h=Extending%20HTML5%20%E2%80%94%20Microformats" 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%2Fmicroformats%2F&amp;t=Extending%20HTML5%20%E2%80%94%20Microformats&amp;s=HTML5%20contains%20a%20bunch%20of%20new%20semantic%20goodness%2C%20but%20sometimes%20we%20need%20more%20semantics%20than%20what%E2%80%99s%20available.%20This%20is%20the%20first%20article%20in%20a%20series%20looking%20at%20various%20ways%20to%20extend%20HTML5%20%E2%80%94%20first%20up%2C%20microformats." 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/microformats/" rel="bookmark">Extending HTML5 — Microformats</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on August 17, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/microformats/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>The ruby element and her hawt friends, rt and rp</title>
		<link>http://html5doctor.com/ruby-rt-rp-element/</link>
		<comments>http://html5doctor.com/ruby-rt-rp-element/#comments</comments>
		<pubDate>Tue, 11 May 2010 14:00:55 +0000</pubDate>
		<dc:creator>Oli Studholme</dc:creator>
				<category><![CDATA[Elements]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[rp]]></category>
		<category><![CDATA[rt]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1745</guid>
		<description><![CDATA[<p>The <code>&#60;ruby&#62;</code>, <code>&#60;rt&#62;</code> and <code>&#60;rp&#62;</code> elements allow us to add ‘ruby’ phonetic annotations in languages like Japanese and Chinese. Despite the terrors of internationalisation and patchy browser support — with a little fiddling and a lot of caution — this sexy threesome with adorable accents are ready to use now.</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%2Fruby-rt-rp-element%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fruby-rt-rp-element%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
			</a>
		</div><p><a href="http://en.wikipedia.org/wiki/Ruby_character" title="Ruby character - Wikipedia, the free encyclopedia">Ruby text</a> is a short annotation for some base text. It’s typically used to give pronunciation guidance in a phonetic script for kanji in Chinese, Japanese, and Korean (<abbr title="Chinese, Japanese and Korean">CJK</abbr>) languages. It’s named after an old printers’ term for the very small size of 5.5 points.</p>

<blockquote cite="http://dev.w3.org/html5/markup/ruby">
<p>The ruby element allows spans of phrasing content to be marked with ruby annotations.</p>
<cite><a href="http://dev.w3.org/html5/markup/ruby" title="HTML5: ruby — ruby annotation (NEW)">W3C Specification</a></cite>
</blockquote>

<p>As the name implies, ruby text is small<!-- IE=6pt, Webkit=60% -->, displayed by default above the base text in horizontal text and to the right in vertical text. Browsers without <code>&lt;ruby&gt;</code> support put the ruby text inline after the base text.</p>

<p>These are the elements used in creating ruby text in <abbr>HTML</abbr>5:</p>

<ul>
<li><code>&lt;ruby&gt;</code> — an inline element that contains base text with ruby annotations</li>
<li><code>&lt;rt&gt;</code> — ruby text, coming after the base text it defines</li>
<li><code>&lt;rp&gt;</code> — ruby parentheses, an element used to wrap opening and closing parentheses around <code>&lt;rt&gt;</code> ruby text. These are for user agents that don’t support ruby text, so that it makes sense when displayed inline. Browsers that support <code>&lt;ruby&gt;</code> hide <code>&lt;rp&gt;</code> via <code>{display:none;}</code>.</li>
</ul>

<section id="examples">
<h2>Examples</h2>

<p>If you’ve never seen ruby in action you’re probably wondering what I’m talking about, so here are some examples:</p>

<figure>
<img src="/wp-content/uploads/2010/05/vagabond.jpg" width="279" height="250" alt="Vagabond">
<figcaption><i lang="ja-latn">Furigana</i> ruby text in the Japanese manga <a href="http://en.wikipedia.org/wiki/Vagabond_(manga)" title="Vagabond (manga) - Wikipedia, the free encyclopedia">Vagabond</a></figcaption>
</figure>

<figure>
<img src="/wp-content/uploads/2010/05/bopomofo-newspaper.png" width="38" height="147" alt="Bopomofo Newspaper" />
<figcaption>Snippet of a <a href="http://wss.djes.tp.edu.tw/report/Lists/Photos/951222%E5%9C%8B%E8%AA%9E%E6%97%A5%E5%A0%B1/%E5%9C%8B%E8%AA%9E%E6%97%A5%E5%A0%B1.jpg" title="Image of a Taiwanese newspaper with bopomofo ruby for students">Taiwanese newspaper for students</a>, with <i lang="zh-latn">bopomofo</i> ruby</figcaption>
</figure>

<figure>
<img src="/wp-content/uploads/2010/05/chosun.png" width="405" height="72" alt="Typical Korean usage of hanji in a Korean news website" />
<figcaption>Korean <i lang="kr-latn">hangul</i> followed by <i lang="kr-latn">hanja</i> in an editorial on <a href="http://news.chosun.com/site/data/html_dir/2010/04/19/2010041902457.html">Chosun.com</a></figcaption>
</figure>

</section>

<section id="browser-support">
<h2>Browser support</h2>

<p>As is often the way with internationalisation features, browser support is — well, sparse. In a break from your expectations, Internet Explorer has supported <code>&lt;ruby&gt;</code> since <abbr>IE</abbr>5 — three years before the actual 2001 <a href="http://www.w3.org/TR/ruby/" title="Ruby Annotation">W3C Ruby Annotation</a> specification! While this specification was incorporated into <a href="http://www.w3.org/TR/xhtml11/changes.html#a_changes" title="XHTML 1.1 - Changes from XHTML 1.0 Strict"><abbr>XHTML</abbr> 1.1</a>, no browser ever implemented it.</p>

<p><code>&lt;ruby&gt;</code> in <abbr>HTML</abbr>5 is based on a reverse-engineering of <abbr>IE</abbr>’s implementation. It also lacks Ruby Annotation’s ‘complex <code>&lt;ruby&gt;</code>’, as these can normally be accomplished via nesting. (Please submit feedback if you have a real-world example that can’t be.) <a href="http://webkit.org/blog/948/ruby-rendering-in-webkit/" title="Surfin’ Safari - Blog Archive  » Ruby Rendering in WebKit">Webkit</a> added <abbr>HTML</abbr>5 <code>&lt;ruby&gt;</code> support at the start of 2010. At the time of writing, <code>&lt;ruby&gt;</code> has made it into Chrome but not Safari. Firefox and Opera have yet to implement <code>&lt;ruby&gt;</code> natively, although there are Firefox extensions for <code>&lt;ruby&gt;</code> support (<a href="http://htmlruby.codeplex.com/" title="HTML Ruby"><abbr>HTML</abbr> Ruby (basic ruby including <abbr>HTML</abbr>5)</a> and <a href="http://piro.sakura.ne.jp/xul/_rubysupport.html.en" title="XUL Apps &gt; XHTML Ruby Support - outsider reflex"><abbr>XHTML</abbr> Ruby (complex ruby)</a>).</p>

<p>On the styling side, there’s the <a href="http://www.w3.org/TR/css3-ruby/" title="CSS3 Ruby Module">W3C <abbr>CSS</abbr>3 Ruby Module</a> (2003). It’s based on Ruby Annotation’s ‘complex ruby’ and is being updated for <abbr>HTML</abbr>5 <code>&lt;ruby&gt;</code>. Because of this, it’s also yet to be implemented beyond the default <abbr>IE</abbr>-level formatting. Ruby text will be used in combination with the <a href="http://dev.w3.org/csswg/css3-text-layout/" title="CSS Text Layout Module Level 3">W3C <abbr>CSS</abbr> Text Layout Module Level 3</a> properties <code>direction</code>, <code>block-flow</code>, and <code>writing-mode</code> for alternative text flow (such as vertical text), but again these have <a href="http://www.zachleat.com/web/2010/02/12/css3-text-writing-mode/" title="CSS 3 Text: A Tale of writing-mode Woe">poor implementation</a>.</p>

<table>
<caption>Summary of browser support for <code>&lt;ruby&gt;</code> display &amp; styling in the five main browsers</caption>
<thead>
<tr>
<th>Browser</th>
<th>Basic <code>&lt;ruby&gt;</code></th>
<th><code>writing-mode</code></th>
<th>‘Complex <code>&lt;ruby&gt;</code>’</th>
<th><abbr>CSS</abbr>3 Ruby (2003)</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Internet Explorer</th>
<td><abbr>IE</abbr>5.5+</td>
<td><abbr>IE</abbr>6+<a href="#css-note1">*</a></td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<th scope="row">Firefox</th>
<td>(via plugin)</td>
<td>-</td>
<td>(via plugin)</td>
<td>-</td>
</tr>
<tr>
<th scope="row">Chrome</th>
<td>Chrome5+</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<th scope="row">Safari</th>
<td>Safari5+</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<th scope="row">Opera</th>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
</tbody>
</table>
<p id="css-note1">Note: <code>writing-mode</code> support in <abbr>IE</abbr>6 was <code>lr-tb</code> and <code>tb-rl</code> only. <a href="http://blogs.msdn.com/ie/archive/2009/05/29/the-css-corner-writing-mode.aspx" title="IEBlog : The CSS Corner: writing-mode"><abbr>IE</abbr>8 added support for all possible combinations</a>.</p>

<section id="usable-css">
<h3><abbr>CSS</abbr> we <em>can</em> use</h3>

<p>Having said that no browsers support the <abbr>CSS</abbr>3 Ruby module yet, there are still a few things we can do to style <code>&lt;ruby&gt;</code> and friends. Default browser styles use <code>font-size</code> and <code>display</code>, so we can safely change these to affect display in both supporting and non-supporting browsers.</p>

<p>If you want to de-emphasise the <code>&lt;rt&gt;</code> ruby text when it’s displayed inline in non-supporting browsers, you could do this via setting the size of <code>&lt;rt&gt;</code> and <code>&lt;rp&gt;</code>, as <abbr>IE</abbr> and Webkit do:</p>

<pre><code>rt, rp {font-size: 60%;} /* = Webkit value */</code></pre>

<p>You can also move ruby text and parentheses to after the base text, mimicking non-supporting browser rendering on supporting browsers:</p>

<pre><code>rt, rp {display: inline; font-size: 100%;}</code></pre>

<p>Finally, if you’re brave/foolish, you can implement ruby display yourself via <abbr>CSS</abbr> <code>inline-table</code> (<a href="http://sideshowbarker.net/2009/11/13/html5-ruby/#comment-3388" title="Carl’s ‘faking ruby’ comment on Mike Smith’s weblog"><abbr>CSS</abbr> with explanation</a> and <a href="http://hiragana.jp/" title="Hiragana Megane (How to Read Japanese)">demonstration (Hiragana.jp)</a>). Note that <a href="https://bugs.webkit.org/show_bug.cgi?id=36803">this currently doesn’t work in Chrome</a> because of a bug with <code>display:inline-table</code> on <code>&lt;ruby&gt;</code> (fixed in trunk), and as you’ll probably need per-browser style tweaks, I recommend against it.</p>

</section>
</section>

<section id="code-samples">
<h2>Code samples and output</h2>

<p><a href="http://oli.jp/example/ruby/" title="Ruby examples ❧ Oli.jp (@boblet)">These code samples</a> (with notes and <abbr>CSS</abbr>) are also available separately.</p>

<section id="ja">
<h3><code>&lt;ruby&gt;</code> in Japanese — <i lang="ja-latn">furigana</i> and <i lang="ja-latn" title="romaji">rōmaji</i></h3>

<section id="without-rp">
<h4>Using <code>&lt;ruby&gt;</code> without <code>&lt;rp&gt;</code></h4>
<figure>
<pre><code>&lt;ruby&gt;攻殻&lt;rt&gt;こうかく&lt;/rt&gt;機動隊&lt;rt&gt;きどうたい&lt;/rt&gt;&lt;/ruby&gt;</code></pre>
<img src="/wp-content/uploads/2010/05/gits.png" width="100" height="50" alt="Furigana example using ruby in a supporting browser (displayed above base text)" />
<img src="/wp-content/uploads/2010/05/gits-inline.png" width="235" height="50" alt="Furigana example using ruby in a non-supporting browser (displayed inline after base text)">
<figcaption>Using <code>&lt;ruby&gt;</code> to indicate the pronunciation of the Japanese name of the <a href="http://en.wikipedia.org/wiki/Ghost_in_the_shell" title="Ghost in the Shell - Wikipedia, the free encyclopedia">Ghost in the Shell anime series</a> in <i lang="ja-latn">furigana</i>. Notice that the lack of <code>&lt;rp&gt;</code> makes it pretty unreadable in a non-supporting browser (you may have to trust me on this!).<!-- this could be faked in browsers supporting generated content via rt:before {content: "(";} and rt:after {content: ")";}, but you can’t then turn it off for supporting browsers --></figcaption>
</figure>
</section>

<section id="with-rp">
<h4>Using <code>&lt;ruby&gt;</code> with <code>&lt;rp&gt;</code></h4>
<figure>
<pre><code>&lt;ruby&gt;攻殻&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;こうかく&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;機動隊&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;きどうたい&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;&lt;/ruby&gt;</code></pre>
<img src="/wp-content/uploads/2010/05/gits.png" width="100" height="50" alt="Furigana example using ruby in a supporting browser (displayed above base text)" />
<img src="/wp-content/uploads/2010/05/gits-parentheses.png" width="300" height="50" alt="Furigana example using ruby in a non-supporting browser (displayed inline with parentheses)" />
<figcaption>The above example with <code>&lt;rt&gt;</code> text surrounded by <code>&lt;rp&gt;</code> parentheses degrades gracefully on non-supporting browsers.</figcaption>
</figure>
</section>

<section id="nested-ruby">
<h4>Nested <code>&lt;ruby&gt;</code> for multiple ruby texts</h4>
<figure>
<pre><code>&lt;ruby&gt;&lt;ruby&gt;攻&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;こう&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;殻&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;かく&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;機&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;き&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;動&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;どう&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;隊&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;たい&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;&lt;/ruby&gt;&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;Kōkakukidōtai&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;&lt;/ruby&gt;</code></pre>
<img src="/wp-content/uploads/2010/05/gits-two-ruby.png" width="110" height="50" alt="Two ruby texts in a supporting browser (both displayed above base text)">
<img src="/wp-content/uploads/2010/05/gits-two-ruby-paren.png" width="520" height="36" alt="Two ruby texts in a non-supporting browser (displayed inline in source order)">
<figcaption>The scope of <code>&lt;rt&gt;</code> depends on the amount of base text before it, from one character to an entire phrase. <code>&lt;ruby&gt;</code> can also be nested to provide multiple ruby texts for one base text — in this case <i lang="ja-latn">furigana</i> and <i lang="ja-latn" title="romaji">rōmaji</i>. Although per-kanji <code>&lt;ruby&gt;</code> is more informative, it degrades somewhat poorly in non-supporting browsers. Copy &amp; paste support is also poor, as browsers just use source order, for example “攻こう殻かく機き動どう隊たい Kōkakukidōtai”. It’s also a <abbr title="pain in the arse">PITA</abbr> to code <img src='http://html5doctor.com/wp-includes/images/smilies/icon_neutral.gif' alt=':-|' class='wp-smiley' /> </figcaption>
</figure>
</section>

<!-- Example of vertical text? -->

<section id="jp-glossary">
<h4>Japanese glossary</h4>

<p><i lang="ja-latn">Furigana</i> is the name given to using <i lang="ja-latn">hiragana</i> phonetic script beside words written in kanji to aid reading. It’s used extensively in education for learners of Japanese, and in reading material for children. It’s also sometimes used when writing kanji a literate adult may not be able to read.</p>

<p><i lang="ja-latn" title="romaji">Rōmaji</i> is the romanisation of Japanese into the latin alphabet. <i lang="ja-latn" title="romaji">Rōmaji</i> is generally used for those who don’t know Japanese, especially in signage and tourism information.</p>
</section>

</section>

<section id="zh">
<h3><code>&lt;ruby&gt;</code> in Chinese — <i lang="zh-latn" title="pinyin">Pīnyīn</i> and <i lang="zh-latn" Title="Zhuyin Fuhao">zhùyīn fúhào</i> (<i lang="zh-latn">bopomofo</i>)</h3>

<p>Ruby is used to some extent in China (<i lang="zh-latn" title="pinyin">pīnyīn</i>), and more so in Taiwan (<i lang="zh-latn" Title="Zhuyin Fuhao">zhùyīn fúhào</i>), especially in textbooks and signage.</p>

<section id="pinyin">
<h4><i lang="zh-latn" title="pinyin">Pīnyīn</i></h4>
<figure>
<pre><code>&lt;p&gt;The &lt;b&gt;Grass mud horse&lt;/b&gt; — &lt;ruby&gt;草泥馬&lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;Cǎo Ní Mǎ&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;&lt;/ruby&gt; — is … characterised as “lively, intelligent and tenacious”. However, their existence is said to be threatened by the “river crabs” — &lt;ruby class="styled"&gt;河蟹&lt;rp&gt; (&lt;/rp&gt;&lt;rt&gt;héxiè&lt;/rt&gt;&lt;rp&gt;) &lt;/rp&gt;&lt;/ruby&gt; — which are invading their habitat.&lt;/p&gt;</code></pre>
<img src="/wp-content/uploads/2010/05/gmh.png" width="570" height="100" alt="Ruby text in a paragraph of text in a supporting browser, leading to significant line-height differences">
<img src="/wp-content/uploads/2010/05/gmh-combo.png" width="570" height="80" alt="Ruby text in a non-supporting browser, with font-size set on rt and rp elements for the second ruby instance">
<figcaption>In this example of <i lang="zh-latn">pinyin</i> you can see how <code>&lt;ruby&gt;</code> significantly affects the leading (<code>&lt;line-height&gt;</code>) of text blocks in supporting browsers. Setting <code>font-size</code> for <code>&lt;rt&gt;</code> and <code>&lt;rp&gt;</code> can de-emphasise ruby text in non-supporting browsers, as demonstrated in the second <code>&lt;ruby&gt;</code> in the second image.</figcaption>
</figure>
</section>

<section id="bopomofo">
<h4><i lang="zh-latn" Title="Zhuyin Fuhao">Zhùyīn fúhào</i></h4>
<figure>
<pre><code>&lt;ruby&gt;&lt;ruby&gt;世&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄕˋ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;上&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄕㄤˋ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;無&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄨˊ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;難&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄋㄢˊ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;事&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄕˋ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;只&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄓˇ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;怕&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄆㄚˋ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;有&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄧㄡˇ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;心&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄒㄧㄣ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;人&lt;rp&gt;（&lt;/rp&gt;&lt;rt&gt;ㄖㄣˊ&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;&lt;/ruby&gt;&lt;rp&gt; （&lt;/rp&gt;&lt;rt&gt;Anything can be done with enough perseverance&lt;/rt&gt;&lt;rp&gt;）&lt;/rp&gt;&lt;/ruby&gt;</code></pre>
<img src="/wp-content/uploads/2010/05/bopomofo.png" width="471" height="56" alt="How this bopomofo *should* look in a supporting browser (which doesn’t exist as far as I know)" />
<img src="/wp-content/uploads/2010/05/bopomofo-chrome.png" width="230" height="55" alt="This bopomofo example in Chrome" />
<img src="/wp-content/uploads/2010/05/bopomofo-firefox.png" width="467" height="84" alt="This bopomofo example in Firefox" />
<!-- http://en.wikiquote.org/wiki/Chinese_proverbs -->
<figcaption>Unfortunately, no browser can render this example of <i lang="zh-latn" Title="Zhuyin Fuhao">Zhùyīn fúhào</i> (<i lang="zh-latn">bopomofo</i>) ruby on horizontal Mandarin Chinese correctly. I’ve included an ideal rendering and how it appears in both a browser supporting simple ruby (with incorrectly rendered <i lang="zh-latn">bopomofo</i>) and a non-supporting browser.</figcaption>
</figure>
</section>

<section id="zh-glossary">
<h4>Chinese glossary</h4>
<p><a href="http://en.wikipedia.org/wiki/Pinyin" title="Pinyin - Wikipedia, the free encyclopedia"><i lang="zh-latn" title="pinyin">Pīnyīn</i></a> is a romanised phonetic system for Chinese, generally written above or after the word. <a href="http://en.wikipedia.org/wiki/Bopomofo" title="Bopomofo - Wikipedia, the free encyclopedia"><i lang="zh-latn">Bopomofo</i> (<i lang="zh-latn" Title="Zhuyin Fuhao">Zhùyīn fúhào</i>)</a> is a phonetic script for transcribing Chinese, especially Mandarin. It is generally written (in both horizontal and vertical scripts) vertically to the right of each <i lang="ja-latn">hanzi</i> character.</p>
</section>
</section>

<section id="ko">
<h3>Korean ruby</h3>
<p>While the use of <i lang="ko-latn">hanja</i> (kanji) is decreasing in South Korea, they are still used for disambiguation and proper names.</p>

<figure>
<pre><code>&lt;ruby&gt;한자&lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;漢字&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;&lt;/ruby&gt;</code></pre>
<img src="/wp-content/uploads/2010/05/hanja.png" alt="Hangul followed inline by hanja in brackets">
<figcaption>Current Korean ruby use is to have the <i lang="kr-latn">hangul</i> coming <em>before</em> the <i lang="kr-latn">hanja</i> in parentheses (the opposite way from the default fallback style). For styling use: <code>rt, rp {display: inline; font-size: 100%;}</code>. This formatting is also used when foreign words such as English are included in Korean text.</figcaption>
</figure>

<section id="ko-glossary">
<h4>Korean glossary</h4>
<p><a href="http://en.wikipedia.org/wiki/Hangul" title="Hangul - Wikipedia, the free encyclopedia"><i lang="kr-latn">Hangul</i></a> is the Korean script, and <a href="http://en.wikipedia.org/wiki/Hanja" title="Hanja - Wikipedia, the free encyclopedia"><i lang="kr-latn">hanja</i></a> is Korean for Chinese characters. Traditionally written Korean used <i lang="kr-latn">hanja</i>, but now it’s mainly used in academic texts and occasionally for disambiguation.</p>
</section>
</section>

<section id="en">
<h3>Using <code>&lt;ruby&gt;</code> for English</h3>

<p>Not everyone is using East Asian languages, but any short annotation is (theoretically) applicable. While English doesn’t typically have pronunciation guidance, phonetic annotations are used in dictionaries:</p>

<!-- styled to make rt appear inline -->
<figure>
<pre><code>&lt;ruby&gt;&lt;strong&gt;cromulent&lt;/strong&gt; &lt;rp&gt;(&lt;/rp&gt;&lt;rt&gt;crôm-yü-lənt&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;&lt;/ruby&gt;</code></pre>
<img src="/wp-content/uploads/2010/05/cromulent.png" width="570" height="80" alt="Displaying ruby text after the base text for an English dictionary">
<figcaption>Using ruby text for a dictionary definition by displaying the ruby text inline after the base text</figcaption>
</figure>
</section>
</section>

<section id="use-it">
<h2><code>&lt;ruby&gt;</code>: to use or not to use</h2>

<p>The main use case of <code>&lt;ruby&gt;</code> is marking up pronunciation in Asian writing, such as <i lang="zh-latn" title="phonetic system for transcribing Chinese">bopomofo</i> for traditional Chinese and <i lang="ja-latn" title="addition of small kana next to kanji to aid reading">furigana</i> for Japanese. I don’t know whether Arabic diacritics like Taškīl, Hebrew Niqqud, or other non-<abbr title="Chinese, Japanese and Korean languages">CJK</abbr> languages would use <code>&lt;ruby&gt;</code> for marking up phonetic annotations or diacritics. The <abbr>WHATWG</abbr> specification says:</p>

<blockquote>
<p>Ruby annotations are short runs of text presented alongside base text, primarily used in East Asian typography as a guide for pronunciation or to include other annotations</p>
<footer><cite><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-ruby-element" title="4.6 Text-level semantics &mdash; HTML5 (including next generation additions still in development)">WHATWG specification</a></cite></footer>
</blockquote>

<p>As someone who uses tools like <a href="http://www.popjisyo.com/WebHint/Portal_e.aspx" title="POPjisyo.com - Dictionary Translation Japanese/Chinese/Korean/Kanji/Hanzi">Popjisyo</a> to add pop-up readings and translations to kanji, I definitely see <code>&lt;ruby&gt;</code> as semantic (and valuable) for ‘phonetic annotation,’ in the same way that <code>&lt;abbr&gt;</code> provides extra information on potentially confusing content. Outside of this usage, however, <code>&lt;ruby&gt;</code> could be seen as a presentational hack. Oh noes! I believe the Korean and English examples above are valid uses, but much like <code>&lt;q&gt;</code> some people think the extra code of using <code>&lt;ruby&gt;</code> is not justified when the default presentation is the same as plain text.</p>

<p>To further muddy the waters, the 2001 W3 Ruby specification included an <a href="http://www.w3.org/TR/ruby/#fig1.6" title="Ruby Annotation">abbreviated word marked up with a visible definition via <code>&lt;ruby&gt;</code></a>, and <a href="http://www.w3.org/TR/ruby/#fig1.9" title="Ruby Annotation">a use-by date where the day, month, and year are added via <code>&lt;ruby&gt;</code></a>. These uses seem like presentational hacks to me, and while they’re not forbidden, the lack of such examples in <abbr>HTML</abbr>5 indicate they’re not exactly blessed either <img src='http://html5doctor.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
</section>

<section id="conclusion">
<h2>In conclusion…</h2>

<p>The most important thing is that the <code>&lt;ruby&gt;</code>, <code>&lt;rt&gt;</code>, and <code>&lt;rp&gt;</code> elements are <em>valid <abbr>HTML</abbr>5</em>, and even if they’re not officially supported, they will by default display <em>as if they were <code>&lt;span&gt;</code>s</em> in non-supporting browsers. Because of this, <strong>if you actually need to use <code>&lt;ruby&gt;</code>, especially for phonetic annotations, do it</strong>! It might not look perfect yet in non-supporting browsers, but this will change, and hey, at least you don’t have <abbr>IE</abbr> support to worry about! <img src='http://html5doctor.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>For non-phonetic annotation, consider using <code>&lt;abbr&gt;</code> to give an expanded reading via mouse-over for an abbreviation or acronym, unless displaying the reading by default is important. Consider <code>&lt;small&gt;</code> for <em>phrasing content</em>-level side comments, if the comment placement is not important and the association with the relevant content doesn’t need to be explicit.</p>
</section>

<section id="ref">
<h2>Further reading</h2>

<ul>
<li><a href="http://webkit.org/blog/948/ruby-rendering-in-webkit/" title="Surfin&#8217; Safari - Blog Archive  &raquo; Ruby Rendering in WebKit">Ruby rendering in Webkit</a> announcement on the Safari weblog</li>
<li><a href="http://my.opera.com/tagawa/blog/the-html5-ruby-element-in-words-of-one-syllable-or-less" title="Daniel Davis - The HTML5 &lt;ruby&gt; element in words of one syllable or less">The <abbr>HTML</abbr>5 &lt;ruby&gt; element in words of one syllable or less</a> by the unstoppable <a href="http://twitter.com/ourmaninjapan" title="Daniel Davis on Twitter @ourmaninjapan">Daniel Davis</a> of Opera</li>
</ul>
</section>

<section id="feedback">
<h2>Feedback please!</h2>

<p>So what do you think of <code>&lt;ruby&gt;</code> and friends? Let us know in the comments! If you know about the use of annotations like this in other languages, or have used <code>&lt;ruby&gt;</code>, tell us about it too!</p>

<!-- Bonus for source readers…

Questions to Hixie:
* would the expiry date would still be valid
* why was complex ruby dropped? no use case?
* would the WWW abbr-as-ruby would still be valid (what about <ruby><abbr>WWW</abbr><rt>world wide web</rt></ruby>)

Answers:
* HTML5 ruby is basically what IE supports
* complex ruby may return in future if there’s a definite use case for it that can’t be solved by nested ruby
* Hixie thought the non-language uses were a bit dodgy <img src='http://html5doctor.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  -->
</section><div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/i-b-em-strong-element/" rel="bookmark" class="crp_title">The i, b, em, &amp; strong elements</a></li><li><a href="http://html5doctor.com/small-hr-element/" rel="bookmark" class="crp_title">The small &amp; hr elements</a></li><li><a href="http://html5doctor.com/html-5-reset-stylesheet/" rel="bookmark" class="crp_title">HTML5 Reset Stylesheet</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><li><a href="http://html5doctor.com/summary-figcaption-element/" rel="bookmark" class="crp_title">Hello, summary and figcaption elements</a></li></ul></div>


Share and Save:


	<a rel="nofollow"  href="http://twitter.com/home?status=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp%20-%20http%3A%2F%2Fhtml5doctor.com%2Fruby-rt-rp-element%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%2Fruby-rt-rp-element%2F&amp;title=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp&amp;bodytext=The%20%26lt%3Bruby%26gt%3B%2C%20%26lt%3Brt%26gt%3B%20and%20%26lt%3Brp%26gt%3B%20elements%20allow%20us%20to%20add%20%E2%80%98ruby%E2%80%99%20phonetic%20annotations%20in%20languages%20like%20Japanese%20and%20Chinese.%20Despite%20the%20terrors%20of%20internationalisation%20and%20patchy%20browser%20support%20%E2%80%94%20with%20a%20little%20fiddling%20and%20a%20lot%20of%20caution%20%E2%80%94%20this%20sexy%20threesome%20with%20adorable%20accents%20are%20ready%20to%20use%20now." 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%2Fruby-rt-rp-element%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%2Fruby-rt-rp-element%2F&amp;title=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp" 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%2Fruby-rt-rp-element%2F&amp;title=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp&amp;notes=The%20%26lt%3Bruby%26gt%3B%2C%20%26lt%3Brt%26gt%3B%20and%20%26lt%3Brp%26gt%3B%20elements%20allow%20us%20to%20add%20%E2%80%98ruby%E2%80%99%20phonetic%20annotations%20in%20languages%20like%20Japanese%20and%20Chinese.%20Despite%20the%20terrors%20of%20internationalisation%20and%20patchy%20browser%20support%20%E2%80%94%20with%20a%20little%20fiddling%20and%20a%20lot%20of%20caution%20%E2%80%94%20this%20sexy%20threesome%20with%20adorable%20accents%20are%20ready%20to%20use%20now." 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%2Fruby-rt-rp-element%2F&amp;title=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp" 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%2Fruby-rt-rp-element%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=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fruby-rt-rp-element%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%2Fruby-rt-rp-element%2F&amp;t=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp" 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%2Fruby-rt-rp-element%2F&amp;title=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp&amp;annotation=The%20%26lt%3Bruby%26gt%3B%2C%20%26lt%3Brt%26gt%3B%20and%20%26lt%3Brp%26gt%3B%20elements%20allow%20us%20to%20add%20%E2%80%98ruby%E2%80%99%20phonetic%20annotations%20in%20languages%20like%20Japanese%20and%20Chinese.%20Despite%20the%20terrors%20of%20internationalisation%20and%20patchy%20browser%20support%20%E2%80%94%20with%20a%20little%20fiddling%20and%20a%20lot%20of%20caution%20%E2%80%94%20this%20sexy%20threesome%20with%20adorable%20accents%20are%20ready%20to%20use%20now." 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=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fruby-rt-rp-element%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%2Fruby-rt-rp-element%2F&amp;t=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp" 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%2Fruby-rt-rp-element%2F&amp;title=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=The%20%26lt%3Bruby%26gt%3B%2C%20%26lt%3Brt%26gt%3B%20and%20%26lt%3Brp%26gt%3B%20elements%20allow%20us%20to%20add%20%E2%80%98ruby%E2%80%99%20phonetic%20annotations%20in%20languages%20like%20Japanese%20and%20Chinese.%20Despite%20the%20terrors%20of%20internationalisation%20and%20patchy%20browser%20support%20%E2%80%94%20with%20a%20little%20fiddling%20and%20a%20lot%20of%20caution%20%E2%80%94%20this%20sexy%20threesome%20with%20adorable%20accents%20are%20ready%20to%20use%20now." 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%2Fruby-rt-rp-element%2F&amp;h=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp" 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%2Fruby-rt-rp-element%2F&amp;t=The%20ruby%20element%20and%20her%20hawt%20friends%2C%20rt%20and%20rp&amp;s=The%20%26lt%3Bruby%26gt%3B%2C%20%26lt%3Brt%26gt%3B%20and%20%26lt%3Brp%26gt%3B%20elements%20allow%20us%20to%20add%20%E2%80%98ruby%E2%80%99%20phonetic%20annotations%20in%20languages%20like%20Japanese%20and%20Chinese.%20Despite%20the%20terrors%20of%20internationalisation%20and%20patchy%20browser%20support%20%E2%80%94%20with%20a%20little%20fiddling%20and%20a%20lot%20of%20caution%20%E2%80%94%20this%20sexy%20threesome%20with%20adorable%20accents%20are%20ready%20to%20use%20now." 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/ruby-rt-rp-element/" rel="bookmark">The ruby element and her hawt friends, rt and rp</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on May 11, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/ruby-rt-rp-element/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>The small &amp; hr elements</title>
		<link>http://html5doctor.com/small-hr-element/</link>
		<comments>http://html5doctor.com/small-hr-element/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 13:58:55 +0000</pubDate>
		<dc:creator>Oli Studholme</dc:creator>
				<category><![CDATA[Elements]]></category>
		<category><![CDATA[hr]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[small]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1506</guid>
		<description><![CDATA[<p>Two more HTML4 presentational elements that have undergone transmogrification to have semantics in HTML5 are <code>&#60;small&#62;</code> and <code>&#60;hr&#62;</code></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%2Fsmall-hr-element%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fsmall-hr-element%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
			</a>
		</div><p><a href="http://html5doctor.com/i-b-em-strong-element/" title="The i, b, em, &amp; strong elements | HTML5 Doctor">We recently examined <code>&lt;i&gt;</code> and <code>&lt;b&gt;</code></a>, presentational HTML4 elements that have been given a new lease on semantic life. Two more elements that have undergone transmogrification to receive semantics in HTML5 are <code>&lt;small&gt;</code> and <code>&lt;hr&gt;</code>:</p>

<ul>
<li><strong><code>&lt;small&gt;</code></strong> — was for smaller text, now used for <em>side comments and small print</em> (<a href="http://dev.w3.org/html5/markup/small.html" title="HTML5: small – small print (CHANGED)">W3C:Markup</a>, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-small-element" title="4.6 Text-level semantics — HTML5 (including next generation additions still in development)">WHATWG</a>)</li>
<li><strong><code>&lt;hr&gt;</code></strong> — was horizontal rule, now used for <em>a paragraph-level thematic break</em> in text (<a href="http://dev.w3.org/html5/markup/hr.html" title="HTML5: hr – thematic break (CHANGED)">W3C:Markup</a>, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/grouping-content.html#the-hr-element" title="4.5 Grouping content — HTML5 (including next generation additions still in development)">WHATWG</a>)</li>
</ul>

<section id="element-small">
<h2>The <code>&lt;small&gt;</code> element</h2>

<blockquote>
<p>The small element represents so-called “small print” such as legal disclaimers and caveats.</p>
<footer><cite><a href="http://dev.w3.org/html5/markup/small.html" title="HTML5: small &#8211; small print (CHANGED)">W3C specification</a></cite></footer>
</blockquote>

<p><code>&lt;small&gt;</code> is now for <em>side comments</em>, which are the inline equivalent of <a href="http://html5doctor.com/understanding-aside/" title="Understanding aside | HTML5 Doctor"><code>&lt;aside&gt;</code></a> — content which is not the main focus of the page. A common example is inline legalese, such as a copyright statement in a page footer, a disclaimer, or licensing information. It can also be used for attribution. <strong>Don’t use it for block-level content</strong> (paragraphs, lists, etc.), as this would be considered main content.</p>

<figure>
<img src="http://html5doctor.com/wp-content/uploads/2010/03/small-license.png" alt="Using the small element for license information" title="Font license" width="524" height="36" class="alignnone size-full wp-image-1510" />
<figcaption>Using <code>&lt;small class="font-license"&gt;</code> to fulfill the requirements of a font license agreement</figcaption>
</figure>

<figure>
<blockquote><p><code>&lt;small&gt;&lt;a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution Share-alike license&lt;/a&gt;&lt;/small&gt;</code></p></blockquote>
<figcaption>Using <code>&lt;small&gt;</code> around a <a href="http://creativecommons.org/choose/" title="Choose a License">Creative Commons license</a> link with <code>rel="license"</code></figcaption>
</figure>

<p><code>&lt;small&gt;</code> text does not need to be smaller than surrounding text — if all you want is smaller text use CSS instead. Use <code>&lt;small&gt;</code> only on inline content. Finally, <code>&lt;small&gt;</code> doesn’t affect the semantics of <code>&lt;em&gt;</code> or <code>&lt;strong&gt;</code>.</p>
</section>

<section id="element-hr">
<h2>The <code>&lt;hr&gt;</code> element</h2>

<blockquote>
<p>The hr element represents a paragraph-level thematic break.</p>
<footer><cite><a href="http://dev.w3.org/html5/markup/hr.html" title="HTML5: hr — thematic break (CHANGED)">W3C specification</a></cite></footer>
</blockquote>

<p><del datetime="2010-03-31T10:43:57+09:00">The “paragraph-level” bit means between <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#paragraph" title="3.2.5 Content models — HTML5 (including next generation additions still in development)">blocks of text</a>, so it can’t be used to separate sections of a site. Instead, <code>&lt;hr&gt;</code> now separates different topics within a section of prose, or between scenes in a novel.</del> <ins datetime="2010-03-31T11:00:02+09:00">After checking with Hixie I found I misinterpreted the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#paragraph" title="3.2.5 Content models — HTML5 (including next generation additions still in development)">paragraph content model</a> (we regret the error!). I learned <code>&lt;hr&gt;</code> actually means “<q cite="http://krijnhoetmer.nl/irc-logs/whatwg/20100331#l-169">end of one section, start of another</q>”, which is the same semantically as <code>&lt;/section&gt;&lt;section&gt;</code>. Because elements like <code>&lt;section&gt;</code> already indicate this intrinsically, <code>&lt;hr&gt;</code> is more for thematic breaks, such as separating different topics within a section of prose, or between scenes in a novel. However you can use it anywhere you can use a <code>&lt;p&gt;</code>.</ins> While not widely used these days (given the dull default browser renderings), it can be replaced via CSS with an image:</p>

<figure>
<a href="http://oli.jp/example/speckled-band/"><img src="http://html5doctor.com/wp-content/uploads/2010/03/hr-separator.png" alt="Horizontal rule (hr) separator, replaced using CSS with a background image" title="Horizontal rule separator" width="432" height="228" class="alignnone size-full wp-image-1511" /></a>
<figcaption>Style <code>&lt;hr&gt;</code> by removing borders and adding margins &amp; a background image using CSS. For example;<br />
<code>hr {height: 24px; background: url('flourish.png') no-repeat 50% 50%; margin: 3em 0; border: 0;}</code></figcaption>
</figure>

<p>IE7 and lower live up to reputation by adding a border around the image regardless, but <a href="http://blog.neatlysliced.com/2008/03/hr-image-replacement/" title="HR Image Replacement &rsaquo; Neatly Sliced">this can often be worked around</a>. Alternatively you can just hide it via an IE7-and-lower stylesheet. Use a CSS border or background image on another element instead if the transition is obvious (for example between weblog comments), or the intended use is solely presentational.</p>
<figure>
<a href="http://corkd.com/"><img src="http://html5doctor.com/wp-content/uploads/2010/03/corkd.png" alt="Cork’d title with decorative background image" title="A stylish title on Cork’d (thanks Lindsay!)" width="240" height="60" class="alignnone size-full wp-image-1512" /></a>
<figcaption><a href="http://corkd.com/" title="Cork'd | The new way to review, share and discuss wine.">Cork’d.com</a> uses a decorative CSS background image on titles. This would <strong>not</strong> be a good place to use <code>&lt;hr&gt;</code>.</figcaption>
</figure>
</section>

<section id="summary">
<h2>In summary</h2>
<p>When HTML4 was released, the presentational elements <code>&lt;basefont&gt;</code>, <code>&lt;font&gt;</code>, <code>&lt;s&gt;</code>, <code>&lt;strike&gt;</code>, and <code>&lt;u&gt;</code> were already deprecated in favour of CSS. HTML5 completes this by removing <code>&lt;big&gt;</code> and <code>&lt;tt&gt;</code>.</p>

<p>The remaining HTML4 presentational elements — the long-ignored <code>&lt;small&gt;</code> and <code>&lt;hr&gt;</code> elements (along with <a href="http://html5doctor.com/i-b-em-strong-element/" title="The i, b, em, &amp; strong elements | HTML5 Doctor"><code>&lt;i&gt;</code> and <code>&lt;b&gt;</code> from last week</a>) — have been redefined in HTML5 with useful, media-independent semantics that relate to their typical use. Will <em>you</em> be using them? Let us know in the comments!</p>
</section><div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/the-figure-figcaption-elements/" rel="bookmark" class="crp_title">The figure &#038; figcaption elements</a></li><li><a href="http://html5doctor.com/i-b-em-strong-element/" rel="bookmark" class="crp_title">The i, b, em, &amp; strong elements</a></li><li><a href="http://html5doctor.com/html-5-reset-stylesheet/" rel="bookmark" class="crp_title">HTML5 Reset Stylesheet</a></li><li><a href="http://html5doctor.com/ruby-rt-rp-element/" rel="bookmark" class="crp_title">The ruby element and her hawt friends, rt and rp</a></li><li><a href="http://html5doctor.com/the-section-element/" rel="bookmark" class="crp_title">The section element</a></li></ul></div>


Share and Save:


	<a rel="nofollow"  href="http://twitter.com/home?status=The%20small%20%26amp%3B%20hr%20elements%20-%20http%3A%2F%2Fhtml5doctor.com%2Fsmall-hr-element%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%2Fsmall-hr-element%2F&amp;title=The%20small%20%26amp%3B%20hr%20elements&amp;bodytext=Two%20more%20HTML4%20presentational%20elements%20that%20have%20undergone%20transmogrification%20to%20have%20semantics%20in%20HTML5%20are%20%26lt%3Bsmall%26gt%3B%20and%20%26lt%3Bhr%26gt%3B" 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%2Fsmall-hr-element%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%2Fsmall-hr-element%2F&amp;title=The%20small%20%26amp%3B%20hr%20elements" 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%2Fsmall-hr-element%2F&amp;title=The%20small%20%26amp%3B%20hr%20elements&amp;notes=Two%20more%20HTML4%20presentational%20elements%20that%20have%20undergone%20transmogrification%20to%20have%20semantics%20in%20HTML5%20are%20%26lt%3Bsmall%26gt%3B%20and%20%26lt%3Bhr%26gt%3B" 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%2Fsmall-hr-element%2F&amp;title=The%20small%20%26amp%3B%20hr%20elements" 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%2Fsmall-hr-element%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=The%20small%20%26amp%3B%20hr%20elements&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fsmall-hr-element%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%2Fsmall-hr-element%2F&amp;t=The%20small%20%26amp%3B%20hr%20elements" 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%2Fsmall-hr-element%2F&amp;title=The%20small%20%26amp%3B%20hr%20elements&amp;annotation=Two%20more%20HTML4%20presentational%20elements%20that%20have%20undergone%20transmogrification%20to%20have%20semantics%20in%20HTML5%20are%20%26lt%3Bsmall%26gt%3B%20and%20%26lt%3Bhr%26gt%3B" 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=The%20small%20%26amp%3B%20hr%20elements&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fsmall-hr-element%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%2Fsmall-hr-element%2F&amp;t=The%20small%20%26amp%3B%20hr%20elements" 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%2Fsmall-hr-element%2F&amp;title=The%20small%20%26amp%3B%20hr%20elements&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=Two%20more%20HTML4%20presentational%20elements%20that%20have%20undergone%20transmogrification%20to%20have%20semantics%20in%20HTML5%20are%20%26lt%3Bsmall%26gt%3B%20and%20%26lt%3Bhr%26gt%3B" 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%2Fsmall-hr-element%2F&amp;h=The%20small%20%26amp%3B%20hr%20elements" 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%2Fsmall-hr-element%2F&amp;t=The%20small%20%26amp%3B%20hr%20elements&amp;s=Two%20more%20HTML4%20presentational%20elements%20that%20have%20undergone%20transmogrification%20to%20have%20semantics%20in%20HTML5%20are%20%26lt%3Bsmall%26gt%3B%20and%20%26lt%3Bhr%26gt%3B" 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/small-hr-element/" rel="bookmark">The small &amp; hr elements</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on March 16, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/small-hr-element/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>The i, b, em, &amp; strong elements</title>
		<link>http://html5doctor.com/i-b-em-strong-element/</link>
		<comments>http://html5doctor.com/i-b-em-strong-element/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 15:40:01 +0000</pubDate>
		<dc:creator>Oli Studholme</dc:creator>
				<category><![CDATA[Elements]]></category>
		<category><![CDATA[b]]></category>
		<category><![CDATA[em]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[i]]></category>
		<category><![CDATA[strong]]></category>

		<guid isPermaLink="false">http://html5doctor.com/?p=1443</guid>
		<description><![CDATA[<p>While many HTML4 elements have been brought into HTML5 essentially unchanged, several historically presentational ones have been given semantic meanings. Let’s look at <code>&#60;i&#62;</code> and <code>&#60;b&#62;</code> and compare them to the semantic stalwarts <code>&#60;em&#62;</code> and <code>&#60;strong&#62;</code>.</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%2Fi-b-em-strong-element%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhtml5doctor.com%2Fi-b-em-strong-element%2F&amp;source=html5doctor&amp;style=normal&amp;service=is.gd" height="61" width="50" />
			</a>
		</div><p>While many HTML4 elements have been brought into HTML5 essentially unchanged, several historically presentational ones have been given semantic meanings.</p>

<span id="more-1443"></span>

<p>Let’s look at <code>&lt;i&gt;</code> and <code>&lt;b&gt;</code> and compare them to the semantic stalwarts <code>&lt;em&gt;</code> and <code>&lt;strong&gt;</code>. In summary:</p>

<ul class="toc-list">
<li><strong><code>&lt;i&gt;</code></strong> — was italic, now for <em>text in an “alternate voice,”</em> such as foreign words, technical terms and typographically italicized text (<a href="http://dev.w3.org/html5/markup/i.html" title="HTML5: i &#8211; offset text typically styled in italic">W3C:Markup</a>, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-i-element" title="4.6 Text-level semantics — HTML5 (including next generation additions still in development)">WHATWG</a>)</li>
<li><strong><code>&lt;b&gt;</code></strong> — was bold, now for <em>“stylistically offset” text</em>, such as keywords and typographically emboldened text (<a href="http://dev.w3.org/html5/markup/b.html" title="HTML5: b &#8211; offset text typically styled in bold (CHANGED)">W3C:Markup</a>, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-b-element" title="4.6 Text-level semantics — HTML5 (including next generation additions still in development)">WHATWG</a>)</li>
<li><strong><code>&lt;em&gt;</code></strong> — was emphasis, now for <em>stress emphasis</em>, i.e., something you’d pronounce differently (<a href="http://dev.w3.org/html5/markup/em.html" title="HTML5: em &#8211; emphatic stress (CHANGED)">W3C:Markup</a>, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-em-element" title="4.6 Text-level semantics — HTML5 (including next generation additions still in development)">WHATWG</a>)</li>
<li><strong><code>&lt;strong&gt;</code></strong> — was for stronger emphasis, now for <em>strong importance</em>, basically the same thing (stronger emphasis or importance is now indicated by nesting) (<a href="http://dev.w3.org/html5/markup/strong.html" title="HTML5: strong &#8211; strong importance (CHANGED)">W3C:Markup</a>, <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-strong-element" title="4.6 Text-level semantics — HTML5 (including next generation additions still in development)">WHATWG</a>)</li>
</ul>

<section>
<h2>Giving presentational elements new semantic meanings</h2>

<p><code>&lt;i&gt;</code> and <code>&lt;b&gt;</code> were <a href="http://www.w3.org/TR/html401/present/graphics.html#h-15.2.1" title="Alignment, font styles, and horizontal rules in HTML documents">HTML4 font style elements</a> and are still used presentationally where appropriate to follow typographic conventions. They now have semantic meaning, however, and their style can be changed via CSS, meaning they’re not <em>only</em> presentational — <code>&lt;b&gt;</code>, for example, doesn’t have to be bold. Because of this, <strong>it’s recommended to use classes to indicate meaning</strong> to make it easy to change the style later.</p>

<section id="element-i">
<h3>The <code>&lt;i&gt;</code> element</h3>

<blockquote>
<p>The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose (content whose typical typographic presentation is italicized).</p>
<footer><cite><a href="http://dev.w3.org/html5/markup/i.html" title="HTML5: i &#8211; offset text typically styled in italic">W3C specification</a></cite></footer>
</blockquote>

<p>Things that are typically italicised include foreign words (using the attribute <code>lang=""</code>), taxonomic and technical terms, ship names, inline stage directions in a script, some musical notation, and when representing thoughts or hand-written text inline:</p>

<figure id="deckard"><blockquote cite="http://www.trussel.com/bladerun.htm">
<ol class="script semantic-list">
<li><b class="character">Deckard</b>: Move! Get out of the way!</li>
<li class="action">Deckard fires. Kills Zhora in dramatic slow motion scene.</li>
<li><b class="character">Deckard</b>: <i class="voiceover">The report would be routine retirement of a replicant which didn&#8217;t make me feel any better about shooting a woman in the back. There it was again. Feeling, in myself. For her, for Rachael.</i></li>
<li><b class="character">Deckard</b>: Deckard. B-263-54.</li>
</ol></blockquote>
<figcaption>Using <code>&lt;i class="voiceover"&gt;</code> to indicate a voiceover (alternate mood)</figcaption></figure>

<figure id="japanese">
<blockquote>
<p>We ate <i lang="ja-latn" title="eel">unagi</i>, <i lang="ja-latn" title="seared salmon">aburi-zake</i>, and <i lang="ja-latn" title="octopus">tako</i> sushi last night, but the <i lang="ja-latn" title="fatty bluefin tuna belly—LET’S EAT IT ALL!">toro</i> sushi was all fished out.</p>
</blockquote>
<figcaption>Using <code>&lt;i lang="ja-latn"&gt;</code> to indicate “an idiomatic phrase from another language” (or, Japanese). To check character sets for <code>lang=""</code> values you can use the <a href="http://www.iana.org/assignments/character-sets" title="IANA, monospace-ing like it’s 1989">IANA’s official list of character sets</a> (ouch), or the excellent <a href="http://rishida.net/utils/subtags/" title="ishida &gt;&gt; utilities: Language subtag registry search">Language Subtag Lookup tool by Richard Ishida, W3C</a>.</figcaption>
</figure>

<figure id="nanotyrannus">
<blockquote cite="http://en.wikipedia.org/wiki/Nanotyrannus">
<p><i class="taxonomy">Nanotyrannus</i> (&#8220;dwarf tyrant&#8221;) is a genus of tyrannosaurid dinosaur, and is possibly a juvenile specimen of <i class="taxonomy">Tyrannosaurus</i>. It is based on CMN 7541, a skull collected in 1942 and described by Charles W. Gilmore described in 1946, who gave it the new species <i class="taxonomy">Gorgosaurus lancensis</i>.</p>
</blockquote>
<figcaption>Using <code>&lt;i class="taxonomy"&gt;</code> for taxonomic names</figcaption>
</figure>

<p>Only use <code>&lt;i&gt;</code> when nothing more suitable is available — e.g., <code>&lt;em&gt;</code> for text with stress emphasis, <code>&lt;strong&gt;</code> for text with semantic importance, <code>&lt;cite&gt;</code> for titles in a citation or bibliography, <code>&lt;dfn&gt;</code> for defining a word, and <code>&lt;var&gt;</code> for mathematical variables. Use CSS instead for italicizing blocks of text, such as asides, verse, and (as used here for W3C specification quote) block quotations. Remember to use the <code>class</code> attribute to identify why the element is being used, making it easy to restyle a particular use. You can target <code>lang</code> in CSS using the attribute selector (eg <code>[lang="ja-latn"]</code>).</p>
</section>

<section id="element-b">
<h3>The <code>&lt;b&gt;</code> element</h3>

<blockquote>
<p>The <code>&lt;b&gt;</code> element represents a span of text offset from its surrounding content without conveying any extra importance; for example, keywords in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is bold text.</p>
<footer><cite><a href="http://dev.w3.org/html5/markup/b.html" title="HTML5: b &#8211; offset text typically styled in bold (CHANGED)">W3C specification</a></cite></footer>
</blockquote>

<p>For <code>&lt;b&gt;</code> text that should merely look different, there is no requirement to use <code>font-style: bold;</code> — other styling could include a round-cornered background, larger font size, different color, or formatting such as small caps. For instance, <a href="#deckard">in the script example above</a>, <code>&lt;b class="character"&gt;</code> is used to indicate who’s speaking or narrating.</p>

<p>Text that is bold by typographic convention (and <strong>not</strong> because it’s more important) could include names in a Hollywood gossip column or the initial text on a complex or traditionally designed page:</p>

<figure>
<a href="http://oli.jp/example/speckled-band/"><img src="http://html5doctor.com/wp-content/uploads/2010/02/opening-phrase.png" alt="Opening versal (drop cap), plus styling of first phrase using b" title="Opening phrase" width="528" height="84" class="alignnone size-full wp-image-1464" /></a>
<figcaption>Connecting the versal (drop cap) with the text using <code>&lt;b class="opening-phrase"&gt;</code>. The pseudo-element selector <code>:first-letter</code> is used to create the versal. In this case, the opening phrase is bold only for stylistic reasons, but if it was semantically important, <code>&lt;strong&gt;</code> or some other element would be more appropriate. <del datetime="2010-03-10T23:51:21+09:00">Note that <code>:first-letter</code> only applies to block-level elements, so the versal “I” is not inside <code>&lt;b&gt;</code>.</del></figcaption>
</figure>

<figure>
<a href="http://oli.jp/example/speckled-band/"><img src="http://html5doctor.com/wp-content/uploads/2010/02/opening-line.png" alt="Using :first-line instead of the b element" title="Opening line" width="528" height="156" class="alignnone size-full wp-image-1463" /></a>
<figcaption>While we can use <code>&lt;b&gt;</code> to apply a traditional typographic style like small-caps to the first word, phrase or sentence, the CSS pseudo-element selector <code>:first-line</code> is more appropriate in this case. For the first paragraph of <a href="http://html5doctor.com/" title="HTML5 Doctor, helping you implement HTML5 today">HTML5Doctor.com</a> articles we use the nifty <code>:first-of-type</code> CSS3 pseudo-class selector.</figcaption>
</figure>

<p>Only use <code>&lt;b&gt;</code> when there are no other more suitable elements — e.g., <code>&lt;strong&gt;</code> for text with semantic importance, <code>&lt;em&gt;</code> for emphasized text (text with “stress emphasis”), <code>&lt;h1&gt;</code>–<code>&lt;h6&gt;</code> for titles, and <code>&lt;mark&gt;</code> for highlighted or marked text. Use classes on list items for a <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#tag-clouds" title="4.12 Links — HTML5 (including next generation additions still in development)">tag cloud</a>. To recreate traditional typographic effects, use <a href="http://www.w3.org/TR/CSS2/selector.html#pseudo-element-selectors" title="Selectors">CSS pseudo-element selectors</a> like <code>:first-line</code> and <code>:first-letter</code> where appropriate. Again, remember to use the <code>class</code> attribute to identify why the element is being used, making it easy to restyle a particular use.</p>

</section>
</section>

<section>
<h2>…and for comparison, the <code>&lt;em&gt;</code> and <code>&lt;strong&gt;</code> elements</h2>

<p class="callout highlight-block">While <code>&lt;em&gt;</code> and <code>&lt;strong&gt;</code> have remained pretty much the same, there has been a slight realignment in their meanings. In HTML4 they meant ‘emphasis’ and ‘strong emphasis’. Now their meanings have been differentiated into <code>&lt;em&gt;</code> representing <em>stress emphasis</em> (i.e., something you’d pronounce differently), and <code>&lt;strong&gt;</code> representing <em>importance</em>.</p>

<section>
<h3 id="element-em">The <code>&lt;em&gt;</code> element</h3>
<blockquote>
<p>The em element represents a span of text with emphatic stress.</p>
<footer><cite><a href="http://dev.w3.org/html5/markup/em.html" title="HTML5: em &#8211; emphatic stress (CHANGED)">W3C specification</a></cite></footer>
</blockquote>

<p>The ‘stress’ being referred to is linguistic. If spoken, this stress would be emphasised pronunciation on a word that can change the nuance of a sentence. For example, “Call a <em>doctor</em> now!” emphasises the importance of calling a doctor, perhaps in reply to someone asking “Should I get a nurse?” In contrast, “Call a doctor <em>now</em>!” emphasises the importance of calling immediately.</p>

<p>Use <code>&lt;strong&gt;</code> instead to indicate importance and <code>&lt;i&gt;</code> when you want italics without implying emphasis. The level of nesting represents the level of emphasis.</p>
</section>

<section id="element-strong">
<h3>The <code>&lt;strong&gt;</code> element</h3>
<blockquote>
<p>The strong element represents a span of text with strong importance.</p>
<footer><cite><a href="http://dev.w3.org/html5/markup/strong.html" title="HTML5: strong &#8211; strong importance (CHANGED)">W3C specification</a></cite></footer>
</blockquote>

<p>Not much more to say really — it’s the <code>&lt;strong&gt;</code> we all know so well. Indicate relative importance by nesting <code>&lt;strong&gt;</code> elements, and use <code>&lt;em&gt;</code> for text with stress emphasis, or <code>&lt;b&gt;</code> for text that is “stylistically offset” or bold without being more important.</p>
</section>
</section>

<section>
<h2>In summation…</h2>
<p>A final thing to note: these elements (and almost all HTML5 elements) have also been made explicitly <em>media-independent</em>, meaning their semantics are not tied to how they look in a visual browser.</p>

<p>So there you have it — two stray dogs of presentational HTML4 have been transformed into meaningful HTML5 elements, ready to be adopted into your coding once again. Can <em>you</em> resist their semantically shiny puppy-dog eyes? Let us know!</p>

</section><div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://html5doctor.com/small-hr-element/" rel="bookmark" class="crp_title">The small &amp; hr elements</a></li><li><a href="http://html5doctor.com/ruby-rt-rp-element/" rel="bookmark" class="crp_title">The ruby element and her hawt friends, rt and rp</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/html-5-reset-stylesheet/" rel="bookmark" class="crp_title">HTML5 Reset Stylesheet</a></li><li><a href="http://html5doctor.com/measure-up-with-the-meter-tag/" rel="bookmark" class="crp_title">Measure up with the meter tag</a></li></ul></div>


Share and Save:


	<a rel="nofollow"  href="http://twitter.com/home?status=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements%20-%20http%3A%2F%2Fhtml5doctor.com%2Fi-b-em-strong-element%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%2Fi-b-em-strong-element%2F&amp;title=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements&amp;bodytext=While%20many%20HTML4%20elements%20have%20been%20brought%20into%20HTML5%20essentially%20unchanged%2C%20several%20historically%20presentational%20ones%20have%20been%20given%20semantic%20meanings.%20Let%E2%80%99s%20look%20at%20%26lt%3Bi%26gt%3B%20and%20%26lt%3Bb%26gt%3B%20and%20compare%20them%20to%20the%20semantic%20stalwarts%20%26lt%3Bem%26gt%3B%20and%20%26lt%3Bstrong%26gt%3B." 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%2Fi-b-em-strong-element%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%2Fi-b-em-strong-element%2F&amp;title=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements" 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%2Fi-b-em-strong-element%2F&amp;title=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements&amp;notes=While%20many%20HTML4%20elements%20have%20been%20brought%20into%20HTML5%20essentially%20unchanged%2C%20several%20historically%20presentational%20ones%20have%20been%20given%20semantic%20meanings.%20Let%E2%80%99s%20look%20at%20%26lt%3Bi%26gt%3B%20and%20%26lt%3Bb%26gt%3B%20and%20compare%20them%20to%20the%20semantic%20stalwarts%20%26lt%3Bem%26gt%3B%20and%20%26lt%3Bstrong%26gt%3B." 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%2Fi-b-em-strong-element%2F&amp;title=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements" 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%2Fi-b-em-strong-element%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=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements&amp;url=http%3A%2F%2Fhtml5doctor.com%2Fi-b-em-strong-element%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%2Fi-b-em-strong-element%2F&amp;t=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements" 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%2Fi-b-em-strong-element%2F&amp;title=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements&amp;annotation=While%20many%20HTML4%20elements%20have%20been%20brought%20into%20HTML5%20essentially%20unchanged%2C%20several%20historically%20presentational%20ones%20have%20been%20given%20semantic%20meanings.%20Let%E2%80%99s%20look%20at%20%26lt%3Bi%26gt%3B%20and%20%26lt%3Bb%26gt%3B%20and%20compare%20them%20to%20the%20semantic%20stalwarts%20%26lt%3Bem%26gt%3B%20and%20%26lt%3Bstrong%26gt%3B." 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=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements&amp;link=http%3A%2F%2Fhtml5doctor.com%2Fi-b-em-strong-element%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%2Fi-b-em-strong-element%2F&amp;t=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements" 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%2Fi-b-em-strong-element%2F&amp;title=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements&amp;source=HTML5+Doctor+helping+you+implement+HTML5+today&amp;summary=While%20many%20HTML4%20elements%20have%20been%20brought%20into%20HTML5%20essentially%20unchanged%2C%20several%20historically%20presentational%20ones%20have%20been%20given%20semantic%20meanings.%20Let%E2%80%99s%20look%20at%20%26lt%3Bi%26gt%3B%20and%20%26lt%3Bb%26gt%3B%20and%20compare%20them%20to%20the%20semantic%20stalwarts%20%26lt%3Bem%26gt%3B%20and%20%26lt%3Bstrong%26gt%3B." 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%2Fi-b-em-strong-element%2F&amp;h=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements" 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%2Fi-b-em-strong-element%2F&amp;t=The%20i%2C%20b%2C%20em%2C%20%26amp%3B%20strong%20elements&amp;s=While%20many%20HTML4%20elements%20have%20been%20brought%20into%20HTML5%20essentially%20unchanged%2C%20several%20historically%20presentational%20ones%20have%20been%20given%20semantic%20meanings.%20Let%E2%80%99s%20look%20at%20%26lt%3Bi%26gt%3B%20and%20%26lt%3Bb%26gt%3B%20and%20compare%20them%20to%20the%20semantic%20stalwarts%20%26lt%3Bem%26gt%3B%20and%20%26lt%3Bstrong%26gt%3B." 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/i-b-em-strong-element/" rel="bookmark">The i, b, em, &amp; strong elements</a> originally appeared on <a href="http://html5doctor.com">HTML5 Doctor</a> on March 9, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://html5doctor.com/i-b-em-strong-element/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
	</channel>
</rss>
