<?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>Kaizou &#187; XHTML</title>
	<atom:link href="http://www.kaizou.org/category/xhtml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kaizou.org</link>
	<description>This is Web 2.71828</description>
	<lastBuildDate>Sun, 16 May 2010 21:17:53 +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>HTML 5 &lt;audio&gt; &amp; &lt;video&gt; elements</title>
		<link>http://www.kaizou.org/2009/04/html-5-audio-video-elements/</link>
		<comments>http://www.kaizou.org/2009/04/html-5-audio-video-elements/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 17:08:37 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=333</guid>
		<description><![CDATA[One of the most revolutionary concept introduced by HTML 5 is the native support of audio and video playback in web pages. Two new HTML elements have been defined for that purpose: &#60;audio&#62; and &#60;video&#62;, based on the generic media element type. Media elements use a common set of attributes: src: defines the source of [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most revolutionary concept introduced by <a href="http://www.w3.org/TR/html5/" alt="HTML W3C specification">HTML 5</a> is the native support of audio and video playback in web pages.</p>
<p>Two new HTML elements have been defined for that purpose: <a href="http://www.w3.org/TR/html5/video.html#audio" alt="HTML 5 audio element"><code>&lt;audio&gt;</code></a> and <a href="http://www.w3.org/TR/html5/video.html#video" alt="HTML 5 video element"><code>&lt;video&gt;</code></a>, based on the generic <a href="http://www.w3.org/TR/html5/video.html#media-element" alt="HTML 5 media elements">media element type</a>.</p>
<p><a href="http://www.w3.org/TR/html5/video.html#media-element" alt="HTML 5 media elements">Media elements</a> use a common set of attributes:</p>
<ul>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-src" alt="HTML 5 media element src attribute"><code>src</code></a>: defines the source of the media to render,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-autoplay" alt="HTML 5 media element autoplay attribute"><code>autoplay</code></a>: boolean to activate|prevent immediate playback,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-loop" alt="HTML 5 media element loop attribute"><code>loop</code></a>: boolean to activate|prevent automatic looping on content,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#attr-media-controls" alt="HTML 5 media element controls attribute"><code>controls</code></a>: boolean to display|hide browser playback user interface.</li>
</ul>
<p><a href="http://www.w3.org/TR/html5/video.html#video" alt="HTML 5 video element"><code>&lt;video&gt;</code></a> and <a href="http://www.w3.org/TR/html5/video.html#audio" alt="HTML 5 audio element"><code>&lt;audio&gt;</code></a> elements can contain elements to be displayed to the user in older browsers that do not support these new elements.</p>
<p>Below is an example of how to use the <a href="http://www.w3.org/TR/html5/video.html#audio" alt="HTML 5 audio element"><code>&lt;audio&gt;</code></a> element:</p>
<pre>
<code>&lt;audio src="audio.ogv" controls width="100" height="50"&gt;
    &lt;a href="audio.ogv"&gt;Listen&lt;/a&gt;
&lt;/audio&gt;</code>
</pre>
<p>Alternatively to the <a href="http://www.w3.org/TR/html5/video.html#attr-media-src" alt="HTML 5 media element src attribute"><code>src</code></a> attribute, the content to be rendered can be specified using one or more <a href="http://www.w3.org/TR/html5/video.html#the-source-element" alt="HTML 5 source element"><code>&lt;source&gt;</code></a> elements, each of them describing a specific <a href="http://www.w3.org/TR/html5/video.html#media-resource" alt="HTML 5 media resource">media resource</a>.</p>
<p>Each <a href="http://www.w3.org/TR/html5/video.html#the-source-element" alt="HTML 5 source element"><code>&lt;source&gt;</code></a> can be identified by its <a href="http://www.w3.org/TR/html5/video.html#attr-media-src" alt="HTML 5 media element src attribute"><code>src</code></a> and <a href="http://www.w3.org/TR/html5/video.html#attr-source-type" alt="HTML 5 source type attribute"><code>type</code></a> attributes, optionally complemented by a <a href="http://www.w3.org/TR/html5/video.html#attr-source-codecs" alt="HTML 5 media element codecs attribute"><code>codecs</code></a> attribute:</p>
<pre>
<code>&lt;audio controls width="100" height="50"&gt;
     &lt;source src="audio.ogg" type="audio/ogg; codecs=vorbis"&gt;
    &lt;source src="audio.spx" type="audio/ogg; codecs=speex"&gt;
    &lt;source src="audio.oga" type="audio/ogg; codecs=flac"&gt;
&lt;/audio&gt;</code>
</pre>
<p>The  <a href="http://www.w3.org/TR/html5/video.html#video" alt="HTML 5 video element"><code>&lt;video&gt;</code></a> element has an optional <a href="http://www.w3.org/TR/html5/video.html#attr-video-poster" alt="HTML 5 video element poster attribute"><code>poster</code></a> attribute that can be used to define an image to be displayed before the video is played:</p>
<pre>
<code>&lt;video src="oggy.ogv" poster="oggy.jpg" /&gt;</code>
</pre>
<p>These new <a href="http://www.w3.org/TR/html5/video.html#media-element" alt="HTML 5 media elements">media elements</a> also support a set of handy javascript method, properties and events, to allow the fine-grained control of the rendered UI.</p>
<ul>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-play" title="HTML 5 media play method">play()</a></li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-pause" title="HTML 5 media pause method">pause()</a></li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-currenttime" title="HTML 5 media playback time attribute">currentTime</a>: current playback time,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-duration" title="HTML 5 media duration attribute">duration</a>: overall duration of the media,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#dom-media-playbackrate" title="HTML 5 media playback rate attribute">playbackRate</a>: playback speed (can be negative !),</li>
<li><a href="http://www.w3.org/TR/html5/video.html#event-play" title="HTML 5 media play event">onplay()</a>: content has just start playing,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#event-pause" title="HTML 5 media pause event">onpause()</a>: content playback has just been paused,</li>
<li><a href="http://www.w3.org/TR/html5/video.html#event-error" title="HTML 5 media error event">onerror()</a>: an error occurred,</li>
<li>&#8230;</li>
</ul>
<pre>
<code>&lt;script&gt;
function playVideo(url){
     var video = document.getElementById("video");
     video.setAttribute("src",url);
}
&lt;/script&gt;
&lt;video id="videoPlayer" controls=false/&gt;
&lt;p&gt;
     &lt;button type="button"
             onclick="video.playbackRate = -2;"&gt;
         Rew
     &lt;/button&gt;
     &lt;button type="button"
             onclick="video.play();"&gt;
         Play
     &lt;/button&gt;
     &lt;button type="button"
             onclick="video.pause();"&gt;
         Pause
     &lt;/button&gt;
     &lt;button type="button"
                 onclick="video.playbackRate = 2;"&gt;
         FF
     &lt;/button&gt;
&lt;/p&gt;</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/04/html-5-audio-video-elements/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New HTML 5 block-level elements</title>
		<link>http://www.kaizou.org/2009/03/new-html-5-block-level-elements/</link>
		<comments>http://www.kaizou.org/2009/03/new-html-5-block-level-elements/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 11:59:51 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=299</guid>
		<description><![CDATA[The HTML 5 specification introduces new block elements that can be used to structure documents: &#60;section&#62;: represents a document or application section (a content column for instance), &#60;article&#62;: represents an independent piece of content inside a document/section (a blog entry for instance), &#60;aside&#62;: represents a piece of content not directly related to the displayed content [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.w3.org/TR/html5/" alt="W3C HTML 5 Draft">HTML 5 specification</a> introduces new block elements that can be used to structure documents:</p>
<ul>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-section-element" alt="HTML 5 section element"><code>&lt;section&gt;</code></a>: represents a document or application section (a content column for instance),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-article-element" alt="HTML 5 article element"><code>&lt;article&gt;</code></a>: represents an independent piece of content inside a document/section (a blog entry for instance),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-aside-element" alt="HTML 5 aside element"><code>&lt;aside&gt;</code></a>: represents a piece of content not directly related to the displayed content (typically a sidebar),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-header-element" alt="HTML 5 header element"><code>&lt;header&gt;</code></a>: represents a document header,</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-footer-element" alt="HTML 5 footer element"><code>&lt;footer&gt;</code></a>: represents a document footer,</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-nav-element" alt="HTML 5 nav element"><code>&lt;nav&gt;</code></a>: represents a block of navigation links (typically a blog navigation bar),</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-dialog-element" alt="HTML 5 dialog element"><code>&lt;dialog&gt;</code></a>: can be used to render a chat session, using complementary <a href="http://www.w3.org/TR/html5/semantics.html#the-dt-element" alt="HTML 5 dt element"><code>&lt;dt&gt;</code></a> (talker) and <a href="http://www.w3.org/TR/html5/semantics.html#the-dt-element" alt="HTML 5 dd element"><code>&lt;dd&gt;</code></a> (quote) tags,</li>
<li><a href="http://www.w3.org/TR/html5/embedded-content-0.html#the-figure-element" alt="HTML 5 figure element"><code>&lt;figure&gt;</code></a>: can be used to provide textual information about an embedded content,</li>
<li><a href="http://www.w3.org/TR/html5/semantics.html#the-address-element" alt="HTML 5 address element"><code>&lt;address&gt;</code></a>: represents a document/section contact block,</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/03/new-html-5-block-level-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing: HTML 5</title>
		<link>http://www.kaizou.org/2009/03/introducing-html-5/</link>
		<comments>http://www.kaizou.org/2009/03/introducing-html-5/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 15:05:32 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[whatwg]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=281</guid>
		<description><![CDATA[The HTML version you are using everyday is HTML 4.0.1, defined back in 1999 by the W3C. Its XML counterpart is XHTML 1.1, successor of XHTML 1.0 defined in 2000 and revised in 2002 by the W3C. The newest XHTML 2.0 was at first meant to replace both, but the fact that it was not [...]]]></description>
			<content:encoded><![CDATA[<p>The HTML version you are using everyday is <a href="http://www.w3.org/TR/html401/" alt="W3C HTML 4.0.1 specification">HTML 4.0.1</a>, defined back in 1999 by the W3C.</p>
<p>Its XML counterpart is <a href="http://www.w3.org/TR/xhtml11/" alt="W3C XHTML 1.1 specification">XHTML 1.1</a>, successor of <a href="http://www.w3.org/TR/xhtml1/" alt="W3C XHTML 1.0 specification">XHTML 1.0</a> defined in 2000 and revised in 2002 by the W3C.</p>
<p>The newest XHTML 2.0 was at first meant to replace both, but the fact that it was not compatible with XHTML 1.1 raised quite a controversy.</p>
<p>This, added to the fact that some major internet companies and non-profit organizations wanted to expand the typical browser experience to include other internet usages like messaging and media playback led to the creation of the <a href="http://www.whatwg.org/" title="Web Hypertext Application Technology Working Group">Web Hypertext Application Technology Working Group</a> (WHATWG), that released in 2005 the first version of the <a href="http://www.whatwg.org/specs/web-apps/current-work/" alt="WHATWG HTML 5 specification">HTML 5 specification</a>.</p>
<p>The W3C started in 2007 a new HTML working group that took the WHATWG HTML 5 specification as a basis, leading to the publication of the first <a href="http://www.w3.org/TR/html5/" alt="HTML 5 W3C working draft">HTML 5 draft</a> in 2008.</p>
<p>The W3C HTML 5 working group is led by <a href="http://ln.hixie.ch/" alt="Hixie">Ian Hickson</a> from Google, Inc (WHATWG HTML 5 specification editor, CSS 2.1 co-editor, <a href="http://acid2.acidtests.org/#top" alt="Acid 2 CSS test">Acid2</a> and <a href="http://acid3.acidtests.org/#top" alt="Acid 3 CSS test">Acid3</a> developer) and <a href="http://webkit.org/blog/" alt="Surfin' Safari">David Hyatt</a> from Apple, Inc (Safari/Webkit project leader, Firefox co-founder).</p>
<p>The HTML 5 specification defines both HTML and XHTML document types.</p>
<p>The W3C maintains a list of <a href="http://dev.w3.org/html5/html4-differences/" alt="HTML 5 differences from HTML 4">differences between HTML 5 and HTML 4</a>.</p>
<p>I will try to explain these differences in separate posts:</p>
<ul>
<li><a href="/2009/03/new-html-5-block-level-elements/" alt="New HTML 5 block elements"><code>&lt;section&gt;</code> and associated new block-level elements</a>,</li>
<li><a href="/2009/04/html-5-audio-video-elements/" alt="HTML 5 audio and video elements"><code>&lt;audio&gt;</code> &#038; <code>&lt;video&gt;</code> elements</a>,</li>
<li><a href="/2009/04/html-5-offline-web-applications/" alt="HTML 5 offline web applications">offline web applications</a>,</li>
<li> &#8230; TBC &#8230;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/03/introducing-html-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Differences between strict &amp; transitional (X)HTML</title>
		<link>http://www.kaizou.org/2009/03/differences-between-strict-transitional-xhtml/</link>
		<comments>http://www.kaizou.org/2009/03/differences-between-strict-transitional-xhtml/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 14:03:16 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[strict]]></category>
		<category><![CDATA[transitional]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=253</guid>
		<description><![CDATA[HTML and XHTML exist today in two flavors: strict and transitional. By default, a lot of editing tools or CMS use the transitional model. This is a shame because it may lead people to use a deprecated HTML syntax for presenting content instead of using CSS. This will lead to future incompatibilities and extensive use [...]]]></description>
			<content:encoded><![CDATA[<p>HTML and XHTML exist today in two flavors: strict and transitional. By default, a lot of editing tools or CMS use the transitional model.</p>
<p>This is a shame because it may lead people to use a deprecated HTML syntax for presenting content instead of using CSS. This will lead to future incompatibilities and extensive use of the <a href="http://en.wikipedia.org/wiki/Quirks_mode" alt="Quirks mode">&#8220;Quirks mode&#8221;</a>. </p>
<p>I will summarize below the main differences between the strict and transitional models. Then, the reader may be able to figure out whether he can safely switch to (X)HTML strict or not.</p>
<h3>Elements only allowed in transitional (X)HTML</h3>
<p>The list below has been compiled using this full <a href="http://www.blackwidows.co.uk/resources/tutorials/xhtml/element-comparison.php" alt="XHTML 1.0 Element Comparison by DTD">XHTML doctypes element comparison</a></p>
<ul>
<li><code>applet</code>,</li>
<li><code>basefont</code>,</li>
<li><code>center</code>,</li>
<li><code>dir</code>,</li>
<li><code>font</code>,</li>
<li><code>frame</code>,</li>
<li><code>frameset</code>,</li>
<li><code>iframe</code>,</li>
<li><code>isindex</code>,</li>
<li><code>menu</code>,</li>
<li><code>noframes</code>,</li>
<li><code>s</code>,</li>
<li><code>strike</code>,</li>
<li><code>u</code>,</li>
</ul>
<p>Today, only the iframe element is still used widespread, despite the fact that it can be replaced by <code>object</code>.</p>
<h3>Attributes only allowed in transitional (X)HTML</h3>
<p>The list below has been compiled using this full <a href="http://www.blackwidows.co.uk/resources/tutorials/xhtml/attributes-comparison.php" alt="XHTML1.0 Element Attributes by DTD">XHTML doctypes element attributes comparison</a></p>
<ul>
<li><code>align</code> in anything but tables-related elements,</li>
<li><code>alink</code>,</li>
<li><code>background</code>,</li>
<li><code>bgcolor</code>,</li>
<li><code>border</code>,</li>
<li><code>color</code>,</li>
<li><code>compact</code>,</li>
<li><code>dir</code>,</li>
<li><code>face</code>,</li>
<li><code>frameborder</code>,</li>
<li><code>height</code>,</li>
<li><code>hspace</code>,</li>
<li><code>ismap</code>,</li>
<li><code>height</code>,</li>
<li><code>lang</code>,</li>
<li><code>link</code>,</li>
<li><code>noshade</code>,</li>
<li><code>nowrap</code>,</li>
<li><code>object</code>,</li>
<li><code>size</code>,</li>
<li><code>start</code>,</li>
<li><code>target</code> on anchors <code>a</code>,</li>
<li><code>text</code>,</li>
<li><code>type</code>,</li>
<li><code>version</code>,</li>
<li><code>vlink</code>,</li>
<li><code>vspace</code>,</li>
<li><code>width</code>.</li>
</ul>
<p>As you can see, most of these attributes can easily be replaced by CSS rules. The only one that is still used widespread is <code>a.target</code>. In my humble opinion, this is not a problem, because you should not decide to open a link in a new window on behalf of the user. Anyway, if you really want to do that, you can still use javascript.</p>
<h3>Document structure constraints in strict (X)HTML</h3>
<p>The <code>body</code>, <code>blockquote</code> and <code>form</code> must only contain block-lebel elements like <code>div</code> or <code>span</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/03/differences-between-strict-transitional-xhtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Choosing the proper DOCTYPE</title>
		<link>http://www.kaizou.org/2009/03/choosing-the-proper-doctype/</link>
		<comments>http://www.kaizou.org/2009/03/choosing-the-proper-doctype/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 12:47:37 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[doctype]]></category>
		<category><![CDATA[strict]]></category>
		<category><![CDATA[transitional]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=234</guid>
		<description><![CDATA[I have been recently asked to tell the differences between HTML 4.0, XHTML 1.0 and HTML 5.0, and I had to dig in the specifications to provide an answer. Doing this, I realized that I did not really pay attention to the DOCTYPE declarations in my web pages so far, possibly leading to unexpected behaviours [...]]]></description>
			<content:encoded><![CDATA[<p>I have been recently asked to tell the differences between HTML 4.0, XHTML 1.0 and HTML 5.0, and I had to dig in the specifications to provide an answer. Doing this, I realized that I did not really pay attention to the DOCTYPE declarations in my web pages so far, possibly leading to unexpected behaviours in some browsers (see the very detailed article on Wikipedia about <a href="http://en.wikipedia.org/wiki/Quirks_mode" alt="Quirks mode">Quirks mode</a>.</p>
<p>To be short, HTML documents must start with a DOCTYPE declaration that is used by the browser to choose the appropriate rendering. It allows in particular to distinguish between real HTML documents and XHTML documents served as <code>text/html</code> to non-XHTML browsers (though required by the XHTML specification, the DOCTYPE declaration is actually redundant with the namepace declaration if the document is served as <code>application/xhtml+xml</code>).</p>
<p>The current HTML specification is <a href="http://www.w3.org/TR/html401/" alt="W3C HTML 4.01 specification">HTML 4.01</a> (1999). It defines three document types:</p>
<ul>
<li>HTML 4.01 strict, that relies entirely on CSS for presentation</li>
<li>HTML 4.01 transitional, that still allows <a href="/2009/03/differences-between-strict-transitional-xhtml/" alt="Differences between strict &#038; transitional (X)HTML">deprecated presentational markup</a></li>
<li>HTML 4.01 frameset, that must only be used to declare framesets</li>
</ul>
<p>In a first attempt to replace HTML 4.01, the W3C has defined <a href="http://www.w3.org/TR/xhtml1/" alt="W3C XHTML 1.0 specification">XHTML 1.0</a> (2000-2002), that redefines HTML 4.01 using a strict XML syntax. Unsurprisingly, XHTML 1.0 also defines three document types:</p>
<ul>
<li>XHTML 1.0 strict, that is exactly HTML 4.01 strict with closing tags,</li>
<li>XHTML 1.0 transitional, that is exactly HTML 4.01 transitional with closing tags,</li>
<li>XHTML 1.0 frameset, that must only be used to declare framesets.</li>
</ul>
<p>In a later standardization effort, the W3C produced <a href="http://www.w3.org/TR/xhtml11/" alt="W3C XHTML 1.1 Working Draft">XHTML 1.1</a> (WIP), that doesn&#8217;t add much, but defines only a strict DOCTYPE.</p>
<p>To summarize, when developing a new page, the first thing you need to decide is if you go for HTML or XHTML. My recommendation is to always choose HTML unless you really need XHTML (for instance because you want to add <a href="/2009/02/svg-inline-in-xhtml/" alt="SVG inline in XHTML">inline SVG</a>).</p>
<p>Then, in both cases, unless you really need to use the <a href="http://www.kaizou.org/2009/03/differences-between-strict-transitional-xhtml/" alt="Differences between strict &#038; transitional (X)HTML">deprecated HTML syntax</a>, then use the strict DOCTYPE.</p>
<h3>HTML</h3>
<p><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;</code></p>
<h3>XHTML</h3>
<p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;</code></p>
<p>Please note that according to the W3C XHTML guidelines, the XML declaration (<code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code>) should be omitted, as it triggers quirks mode in older versions of Internet Explorer. This is only a problem if you need to specify a different character encoding than UTF-8 (the default).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/03/choosing-the-proper-doctype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inline SVG Fallback</title>
		<link>http://www.kaizou.org/2009/03/inline-svg-fallback/</link>
		<comments>http://www.kaizou.org/2009/03/inline-svg-fallback/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 13:07:15 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[SVG]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[inline]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=178</guid>
		<description><![CDATA[As you may already know, IE doesn&#8217;t support SVG unless you install a plugin like the ASV, that is unfortunately not supported anymore by Adobe. As a web developer willing to use inline SVG, your best bet is thus to provide fallback mechanisms to display IE visitors at least a degraded version of what you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>As you may already know, IE doesn&#8217;t support SVG unless you install a plugin like the ASV, that is unfortunately not supported anymore by Adobe.</p>
<p>As a web developer willing to use inline SVG, your best bet is thus to provide fallback mechanisms to display IE visitors at least a degraded version of what you&#8217;re trying to express/demonstrate, and teach them what they&#8217;re missing by sticking with evil IE.</p>
<p>Luckily, IE will simply ignore any markup it does&#8217;nt know, so you usually don&#8217;t need to bother masking or removing the SVG markup when serving pages to your IE visitors.</p>
<p>This is however not true if you insert plain text if your SVG &#8230; Let&#8217;s take an example.</p>
<p>When you insert the following SVG in your page:</p>
<pre>
<code>&lt;svg xmlns="http://www.w3.org/2000/svg"
       version="1.1" wiewBox="0 0 200 100"&gt;
   &lt;text x="0" y="0"
         font-family="Verdana"
	 font-size="55" fill="blue" &gt;
        Hello, out there
   &lt;/text&gt;
&lt;/svg&gt;</code>
</pre>
<p>IE will ignore all SVG markup and formatting, and actually display the plain text with the current style:</p>
<p>Hello, out there</p>
<p>Now, what happens when you insert HTML markup inside your SVG using the <code>foreignObject</code> tag ?</p>
<pre>
<code>&lt;svg xmlns="http://www.w3.org/2000/svg"
       version="1.1" wiewBox="0 0 200 100"&gt;
   &lt;foreignObject width="200" height="100"&gt;
      &lt;span style="color:blue;"&gt;
        Hello, out there
      &lt;/span&gt;
   &lt;/foreignObject&gt;
&lt;/svg&gt;</code>
</pre>
<p>Well, IE ignores all SVG and displays only the HTML markup embedded in the <code>foreignObject</code> tag:</p>
<p><span style="color:blue;">Hello, out there</span></p>
<p>Based on this behavior, the guys at <a href="http://shepherd-interactive.com/" alt="Sheperd interactive">Sheperd interactive</a> have imagined a very elegant <a href="http://shepherd-interactive.com/#about-us/blog/2008/12/inline-svg-fallback/" alt="inline SVG fallback">inline SVG fallback</a> mechanism that uses <a href="http://www.w3.org/TR/SVG/struct.html#ConditionalProcessing" alt="SVG conditional processing">SVG conditional processing</a>.</p>
<p>In a nutshell, the actual SVG and the IE fallback are embedded in an SVG <code>switch</code>:</p>
<ul>
<li>SVG aware browsers will recognize the conditional directive, and render the first alternative they understand (the actual SVG), ignoring the other (the IE fallback)</li>
<li>IE will silently ignore all SVG markup (including the conditional directive), and go straight to the fallback written in HTML.</li>
</ul>
<p>In the example, below, SVG-aware browsers will display a red circle, and IE a simple text.</p>
<pre>
<code>&lt;svg xmlns="http://www.w3.org/2000/svg"
        version="1.1" wiewBox="0 0 200 100"&gt;
  &lt;switch&gt;
     &lt;circle cx="150px" cy="100px" r="50px"
               fill="#ff0000" stroke="#000000"
               stroke-width="5px"/&gt;
     &lt;foreignObject width="200" height="100"&gt;
        &lt;span style="color:red;"&gt;
          This is not a red circle
        &lt;/span&gt;
     &lt;/foreignObject&gt;
   &lt;/switch&gt;
&lt;/svg&gt;</code>
</pre>
<p>See the actual rendering below:</p>
<p><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="300px" height="200px"><switch><circle cx="150px" cy="100px" r="50px" fill="#ff0000" stroke="#000000" stroke-width="5px"/><foreignObject width="200" height="100"><span style="color:red;">This is not a red circle</span></foreignObject></switch></svg></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/03/inline-svg-fallback/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SVG inline in XHTML</title>
		<link>http://www.kaizou.org/2009/02/svg-inline-in-xhtml/</link>
		<comments>http://www.kaizou.org/2009/02/svg-inline-in-xhtml/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 18:40:12 +0000</pubDate>
		<dc:creator>David Corvoysier</dc:creator>
				<category><![CDATA[SVG]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[inline]]></category>

		<guid isPermaLink="false">http://www.kaizou.org/?p=47</guid>
		<description><![CDATA[SVG is now supported by all web browsers except IE. Opera has the best SVG support, but Safari and Firefox are not far behind. I think it is now time to take advantage of the powerful SVG features. What does SVG add to the web developer toolkit ? Well, as its names indicates, SVG first [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.w3.org/Graphics/SVG/About.html">SVG</a> is now supported by all web browsers except IE. <a href="http://www.opera.com/">Opera</a> has the best SVG support, but <a href="http://www.apple.com/safari/">Safari</a> and <a href="http://www.mozilla.org/firefox/">Firefox</a> are not far behind. I think it is now time to take advantage of the powerful SVG features.</p>
<p>What does SVG add to the web developer toolkit ?</p>
<p>Well, as its names indicates, SVG first provides a simple syntax to draw shapes that scale: it is thus particularly handy to draw screen layouts and buttons. I see some people starting to get interested &#8230;</p>
<p>But wait: SVG also includes a wide range of gradient, opacity and geometric transformations that can be applied not only to native SVG shapes, but also to images. This give you access to many fancy effects very hard to achieve with HTML alone, like for instance image reflection or fading.</p>
<p>Want more ? Check this out: SVG markup can be modified dynamically using javascript, allowing you to actually animate it. Who said cover-flow at the back of the class ?</p>
<p>Animation through javascript sucks on low-end devices ? Well, SVG also includes native animation capabilities (unfortunately only supported today by Opera).</p>
<p>Fair enough, but the whole web is built on top of HTML, and switching to full SVG is definitely an option.</p>
<p>Well, the cherry on the cake is that you don&#8217;t have to: SVG can be inserted inline into XHTML. How powerful that is ?</p>
<p>You will find detailed information on why and how it works on the <a href="http://wiki.svg.org/Inline_SVG">SVG wiki</a>. A method to have inline SVG supported by IE using the <a href="http://www.adobe.com/svg/viewer/install/main.html">Adobe SVG viewer</a> is also provided.</p>
<p>Here is an overview of what you need to do.</p>
<ul>
<li>First, you need to use XHTML, because plain old HTML doesn&#8217;t support being extended by another markup language, and your SVG markup will be ignored by the browsers.</li>
<li>Second, you need to make sure that the SVG-aware browsers know this is XHTML, by delivering your content to them as application/xhtml+xml. You probably nevertheless still want to deliver your content to IE as text/html, so what you need is conditional mime-types based on the Accept header of the user agent.
<ul>
<li>it can be done at the HTTP server level. See example below for apache (example taken from the SVG wiki):
<pre>
<code>AddType text/html .xhtml
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0
RewriteCond %{REQUEST_URI} \.xhtml$
RewriteCond %{THE_REQUEST} HTTP/1\.1
RewriteRule .* - [T=application/xhtml+xml]</code>
</pre>
</li>
<li>If you don&#8217;t have access to your web server configuration, you can still:
<ul>
<li>modify headers on the fly. See an example for PHP below:
<pre>
<code>if(preg_match("|application/xhtml\+xml|i",$_SERVER["HTTP_ACCEPT"]){
  header("Content-Type: application/xhtml+xml");
}</code>
</pre>
</li>
<li>or insert meta tags in the HTML head to specify the proper mime-type. See another example for PHP:
<pre>
<code>if(preg_match("|application/xhtml\+xml|i",$_SERVER["HTTP_ACCEPT"]){
  echo "&lt;meta http-equiv='Content-Type' content='application/xhtml+xml' /&gt;" ;
}</code>
</pre>
</li>
<li>If you use <a href="http://wordpress.org">WordPress</a>, the simpliest way is to use the <a href="http://m0n5t3r.info/work/wordpress-plugins/content-negotiation/">Content-Negotiation</a> plugin</li>
</ul>
</li>
</ul>
</li>
<li>Third, put your SVG under an SVG tag</li>
<pre>
<code>&lt;div id="myDIV"&gt;
    &lt;svg xmlns="http://www.w3.org/2000/svg" version="1.1"
	 xmlns:xlink="http://www.w3.org/1999/xlink"
	 viewBox="0 0 400 50"
	 id="myDIVBG"&gt;
	    &lt;defs&gt;
	      &lt;linearGradient id="myGrad"&gt;
		&lt;stop style="stop-color:#ff5b06;"
                        offset="0" /&gt;
		&lt;stop style="stop-color:#ffb11a;"
                        offset="1" /&gt;
	      &lt;/linearGradient&gt;
	    &lt;/defs&gt;
	    &lt;rect style="fill:url(#myGrad);"
	       width="400" height="50"
               x="0" y="0" rx="10" ry="10" /&gt;
    &lt;/svg&gt;
    <span>HTML Text with SVG background</span>
&lt;/div&gt;</code>
</pre>
<li>Fourth, style your SVG with CSS</li>
<pre>
<code>&lt;style type="text/css"&gt;
#myDIV {
    position:relative;
    width:400px;
    height:50px;
}
#myDIV svg {
    position:absolute;
}
#myDIV svg:hover rect {
    fill: red !important;
}
#myDIV span {
    position:absolute;
    top:15px;
    left:40px;
    font-size: 16px;
    font-weight: bold;
}
&lt;/style&gt;</code>
</pre>
</ul>
<p>The result should look like this:</p>
<style type="text/css">
#myDIV {position:relative;width:400px;height:50px;}
#myDIV svg {position:absolute;}
#myDIV svg:hover rect {fill: red !important;}
#myDIV span {position:absolute;top:15px;left:40px;font-size: 16px;font-weight: bold;}
</style>
<div id="myDIV"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 400 50"><defs>
<linearGradient id="myGrad"><stop style="stop-color: #ff5b06;stop-opacity:1" offset="0"/><stop style="stop-color: #ffb11a;stop-opacity:1" offset="1"/></linearGradient></defs><rect style="fill: url(#myGrad);" width="400px" height="50px" rx="10" ry="10"/></svg><span>HTML Text with SVG background</span></div>
<p>Please note in particular how the CSS styling allows the SVG to be perfectly integrated in the page:</p>
<ul>
<li>the absolute positioning of the svg root element allows the next-coming HTML span to appear on top of the SVG background</li>
<li>the :hover behaviour allows a dynamic update of the SVG rect element fill attribute when the element is moused over</li>
</ul>
<p>You will find more examples below:</p>
<ul>
<li><a href="https://developer.mozilla.org/en/SVG_In_HTML_Introduction">A form with an SVG background at Mozilla&#8217;s</a>,</li>
<li><a href="http://jwatt.org/svg/demos/xhtml-with-inline-svg.xhtml">A simple proof of concept</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kaizou.org/2009/02/svg-inline-in-xhtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
