<?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>selfthinker &#187; html</title>
	<atom:link href="http://blog.selfthinker.org/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.selfthinker.org</link>
	<description>The world according to me</description>
	<lastBuildDate>Wed, 07 Dec 2011 01:52:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>CSS Playing Cards</title>
		<link>http://blog.selfthinker.org/2010/08/23/css-playing-cards/</link>
		<comments>http://blog.selfthinker.org/2010/08/23/css-playing-cards/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 23:40:09 +0000</pubDate>
		<dc:creator>selfthinker</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[cards]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[gimmick]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.selfthinker.org/?p=185</guid>
		<description><![CDATA[Some days ago a friend of mine told me that he would be interested in using pure CSS playing cards for a personal project. A few people have tried CSS playing cards before. But I wasn&#8217;t satisfied with any of our findings, as ideally they should be semantic, accessible and scalable, they shouldn&#8217;t use more [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago a friend of mine told me that he would be interested in using pure <strong>CSS playing cards</strong> for a personal project. A few people have tried CSS playing cards before. But I wasn&#8217;t satisfied with any of our findings, as <strong>ideally they should be semantic, accessible and scalable, they shouldn&#8217;t use more markup than necessary and should be pleasing to the eye</strong>. So, I was up for the challenge and created them myself &#8230;<br />
<span id="more-185"></span></p>
<p>First, let&#8217;s recap what others have done before:</p>
<ul>
<li><a href="http://www.brainjar.com/css/cards/"><strong>Playing Cards with CSS</strong> by Mike Hall</a> was quite innovative at the time, but is very old by now (it is from 2001). Too much markup, only half semantic, but scalable and they don&#8217;t use any CSS3 goodness (because CSS3 didn&#8217;t exist back then).</li>
<li><a href="http://legitimatesounding.com/blog/XHTML_CSS_Playing_Cards.html"><strong>XHTML/CSS Playing Cards</strong> by Jerry Sievert</a> are half semantic, the amount of markup is okay-ish and they are the most accessible out of these four, but they are not scalable and don&#8217;t belong to the beautiful kind.</li>
<li><a href="http://htmyell.com/creating-playing-cards-with-css-html/"><strong>Creating playing cards with CSS &amp; HTML</strong> by Jamie Taylor</a> are quite beautiful, but are very unsemantic, not scalable and have a tad bit too much markup.</li>
<li><a href="http://dribbble.com/shots/37568-CSS-Playing-Cards"><strong>CSS Playing Cards</strong> by Kevin Thompson</a> are my personal favourites out of these four. They are really beautiful, are scalable (although the way they are built doesn&#8217;t display too well if the cards are too small) and plays neatly with CSS3. But although the class names are semantic, the markup (which again, is too much) is not semantic at all and completely inaccessible, i.e. it&#8217;s empty and contains no information about the cards if you turn CSS off.</li>
</ul>
<p>Why my CSS Playing Cards are better? Well, they contain less markup, they are much more semantic and accessible (so they even make sense in Lynx), they are perfectly scalable and good looking.<br />
The only negative thing: The CSS only works in modern browsers. (Tested on Win Firefox 3.6.8, Opera 10.61 and Chrome. Internet Explorer 8 cannot deal with many of the CSS3 goodness, but what makes the code unusable in IE8 is the lack of support for the &#8220;:nth-child(n)&#8221; selector. I implemented a rudimentary fix, though.)</p>
<p>And here&#8217;s the proof. This is the basic markup (only two spans in one div):</p>
<pre>
&lt;div class="card rank-7 spades"&gt;
    &lt;span class="rank"&gt;7&lt;/span&gt;
    &lt;span class="suit"&gt;&amp;spades;&lt;/span&gt;
&lt;/div>
</pre>
<p>Here is one example of a hand:</p>
<div class="playingCards fourColours faceImages rotateHand" style="padding-top: 2em; overflow: hidden;">
<ul class="hand" style="float: left;">
<li>
<div class="card rank-2 diams"><span class="rank">2</span><span class="suit">&diams;</span></div>
</li>
<li>
<div class="card rank-3 hearts"><span class="rank">3</span><span class="suit">&hearts;</span></div>
</li>
<li>
<div class="card rank-4 spades"><span class="rank">4</span><span class="suit">&spades;</span></div>
</li>
<li>
<div class="card rank-5 clubs"><span class="rank">5</span><span class="suit">&clubs;</span></div>
</li>
<li>
<div class="card rank-6 diams"><span class="rank">6</span><span class="suit">&diams;</span></div>
</li>
<li>
<div class="card rank-7 hearts"><span class="rank">7</span><span class="suit">&hearts;</span></div>
</li>
<li>
<div class="card rank-8 spades"><span class="rank">8</span><span class="suit">&spades;</span></div>
</li>
<li>
<div class="card rank-9 clubs"><span class="rank">9</span><span class="suit">&clubs;</span></div>
</li>
<li>
<div class="card rank-10 diams"><span class="rank">10</span><span class="suit">&diams;</span></div>
</li>
<li>
<div class="card rank-j hearts"><span class="rank">J</span><span class="suit">&hearts;</span></div>
</li>
<li>
<div class="card rank-q spades"><span class="rank">Q</span><span class="suit">&spades;</span></div>
</li>
<li>
<div class="card rank-k clubs"><span class="rank">K</span><span class="suit">&clubs;</span></div>
</li>
<li>
<div class="card rank-a diams"><span class="rank">A</span><span class="suit">&diams;</span></div>
</li>
</ul>
<div id="attachment_190" class="wp-caption alignright" style="width: 289px"><img src="http://blog.selfthinker.org/wp-content/uploads/2010/08/css-playing-cards-example.png" alt="" title="" width="279" height="185" class="size-full wp-image-190" /><p class="wp-caption-text">And this is how it looks in Opera</p></div>
<div class="clear"></div>
</div>
<p>Want more? You can see <strong><a href="http://blog.selfthinker.org/wp-content/uploads/2010/08/cards/examples.html">more examples</a></strong> or you can implement them and <a href="http://github.com/selfthinker/CSS-Playing-Cards">check out the code on GitHub</a> as I open-sourced it, of course.</p>
<hr />
<strong>Update</strong> (17 October 2010):<br />
Shortly after I published this, another variant surfaced the web:<br />
<a href="http://sixrevisions.com/css/css3-card-trick-a-fun-css3-experiment/"><strong>CSS3 Card Trick: A Fun CSS3 Experiment</strong> by Alexander Dawson</a> has cards which are not scalable at all, only half semantic and (like all the others) use too much markup, but are really beautiful and stylish.</p>
<p><strong>Update</strong> (2 December 2010):<br />
And I found another version:<br />
<a href="http://www.yaus.com/jeff/2009/07/23/css-cards/"><strong>CSS Cards</strong> by Jeff Yaus</a> are semantic, highly scalable, a bit weird looking, have the least markup of all so far, but are unfortunately not accessible at all.</p>
<p><strong>Last Update</strong> (28 May 2011):<br />
And I found another variety&#8230; But from now on I won&#8217;t update this post anymore, but will update my <strong><a href="http://socialcompare.com/en/comparison/css-playing-cards-pgnq7dx">Comparison of CSS Playing Cards</a></strong> on <a href="http://socialcompare.com/">SocialCompare.com</a> instead.</p>
<p><strong>Really Last Update</strong> (12 June 2011):<br />
I just updated my CSS Playing Cards. <a href="https://github.com/selfthinker/CSS-Playing-Cards/zipball/master">Get the new version from GitHub</a>.<br />
And additionally I built a <strong><a href="http://selfthinker.github.com/CSS-Playing-Cards/">beautiful new project page</a></strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.selfthinker.org/2010/08/23/css-playing-cards/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS Mini-Me</title>
		<link>http://blog.selfthinker.org/2010/03/03/css-mini-me/</link>
		<comments>http://blog.selfthinker.org/2010/03/03/css-mini-me/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 01:36:13 +0000</pubDate>
		<dc:creator>selfthinker</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[gimmick]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.selfthinker.org/?p=158</guid>
		<description><![CDATA[A few days ago I was trying to find my &#8220;body colours&#8221;. I took a photo of my face and colour-picked the most representative bits of my skin, hair, lips and eyes. While the results in themselves (#dcc09b, #3a2810, #b0625e, #3b453d) were nice but also completely unimportant, I wondered what else I could do with [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I was trying to find my &#8220;body colours&#8221;. I took a photo of my face and colour-picked the most representative bits of my skin, hair, lips and eyes. While the results in themselves (<span style="background-color: #dcc09b; color: #000;" title="skin">#dcc09b</span>, <span style="background-color: #3a2810; color: #fff;" title="hair">#3a2810</span>, <span style="background-color: #b0625e; color: #000;" title="lips">#b0625e</span>, <span style="background-color: #3b453d; color: #fff;" title="eyes">#3b453d</span>) were nice but also completely unimportant, I wondered what else I could do with that information.</p>
<p>I first thought about personalising my online CV to match these colours (with hair colour at the top, lip colour at the bottom and eye colour for links, etc). But somehow my body colours don&#8217;t make good website colours.</p>
<div class="photo">
<div class="head">
<div class="hair">
<div class="face">
<div class="eyel"></div>
<div class="eyer"></div>
<div class="lips"></div>
</div>
</div>
</div>
<div class="text">me</div>
</div>
<p>Instead I played around with those colours and created a pure HTML and CSS &#8220;image&#8221; of myself (the core code consists of just five divs). <span lang="fr">Et voilà</span>, here it is.</p>
<p>You will only see the full beauty of it if you use a modern browser (and can see). It&#8217;s funny how IE6 still shows something which is recognisable as a face, but turns it into some kind of a monster:</p>
<div id="attachment_159" class="wp-caption aligncenter" style="width: 289px"><img src="http://blog.selfthinker.org/wp-content/uploads/2010/03/minime_browsers.png" alt="" title="" width="279" height="171" class="size-full wp-image-159" /><p class="wp-caption-text">Beauty is in the eyes of the browser</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.selfthinker.org/2010/03/03/css-mini-me/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Silent Twittering</title>
		<link>http://blog.selfthinker.org/2009/06/27/silent-twittering/</link>
		<comments>http://blog.selfthinker.org/2009/06/27/silent-twittering/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 20:50:12 +0000</pubDate>
		<dc:creator>selfthinker</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[information overload]]></category>
		<category><![CDATA[joke]]></category>
		<category><![CDATA[micro blogging]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.selfthinker.org/?p=118</guid>
		<description><![CDATA[I am not a &#8216;Twitter person&#8217;. Watching Hugh Laurie a few weeks ago on Friday Night with Jonathan Ross saying he is none as well was a joy. But when he uttered the following joke, he gave away a splendid idea for a sensational new micro blogging site: I&#8217;m not a &#8216;Twitter person&#8217; &#8230; I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I am not a &#8216;<a href="http://twitter.com/">Twitter</a> person&#8217;. Watching <a href="http://en.wikipedia.org/wiki/Hugh_Laurie">Hugh Laurie</a> a few weeks ago on <a href="http://en.wikipedia.org/wiki/Friday_Night_with_Jonathan_Ross">Friday Night with Jonathan Ross</a> saying he is none as well was a joy. But when he uttered the following joke, he gave away a splendid idea for a sensational new micro blogging site:</p>
<blockquote>
<p>I&#8217;m <strong>not</strong> a &#8216;Twitter person&#8217; &#8230; I&#8217;m more of a &#8216;<strong>Shh</strong> person&#8217;. I subscribed to this &#8216;<strong>Shh</strong> network&#8217;, where you write something down, but don&#8217;t send it anywhere.</p>
</blockquote>
<p>I thought someone might have picked this idea up or had the same idea before, but my short search for such an (obviously hoax) service was unsuccessful. So, I created one myself:</p>
<p><strong><a href="http://shh.selfthinker.org/">Shh&#8230;</a></strong></p>
<p>Apart from the fun of &#8220;cloning&#8221; Twitter, writing a better front-end code and having the satisfying feeling of implementing a small project all in one day, I also had the idea of twittering silence on twitter itself. You can follow my as interesting as everybody else&#8217;s tweets on:</p>
<p><strong><a href="http://twitter.com/_shh">@_shh</a></strong></p>
<p>By the way, I needed the underscore because a twitter user called &#8216;shh&#8217; already existed &#8230; as did &#8216;shhh&#8217; &#8230; and &#8216;shhhh&#8217; &#8230; and &#8216;shhhhh&#8217; &#8230; I could have taken &#8216;shhhhhhhhhhhhhhh&#8217;, but maybe that wouldn&#8217;t have been such a good idea. Seems a bit desperate, doesn&#8217;t it?</p>
<p>These two projects are really a bit unrelated. They serve the purpose of linking to each other. (Yeah, my middle name is &#8220;PR&#8221;. Or was it &#8220;SEO&#8221;? Where is your birth certificate when you need it?)<br />
And, of course, they share the same philosophy: <strong>&#8220;Silent twittering&#8221; for fun and more privacy awareness</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.selfthinker.org/2009/06/27/silent-twittering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sliding Doors Squared</title>
		<link>http://blog.selfthinker.org/2009/03/29/sliding-doors-squared/</link>
		<comments>http://blog.selfthinker.org/2009/03/29/sliding-doors-squared/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 20:06:48 +0000</pubDate>
		<dc:creator>selfthinker</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[rounded corners]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.selfthinker.org/?p=91</guid>
		<description><![CDATA[A few days ago I was searching for the best production usable solution for rounded corners in XHTML/CSS. I know there is no perfect solution, as many people have different needs and each new technique has its disadvantages. But I finally found something very close to it &#8230; What I was looking for: usable in [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I was searching for the best production usable solution for rounded corners in XHTML/CSS. I know there is no perfect solution, as many people have different needs and each new technique has its disadvantages. But I finally found something very close to it &#8230;</p>
<p><span id="more-91"></span> What I was looking for:</p>
<ul>
<li>usable in a production environment: should work in all major browsers</li>
<li>should satisfy designers: should make it possible to have fancy borders, gradient backgrounds, drop shadows, etc</li>
<li>should satisfy coders: usable, accessible, semantic (to a certain extent), no JavaScript, not too many unnecessary extra elements or hacks</li>
<li>flexible: resizable, shrink-wrappable, same code for big boxes or small link buttons, easy to maintain, easy to adjust</li>
<li>optional: creating them should not involve too much work</li>
</ul>
<p>Nearly every technique I used before needed a fixed width or had only two rounded corners or had other drawbacks. I had only found one single technique that fulfilled all my basic needs, but was not very handy to use and had other limitations (such as no way to do a decent hover effect, difficult to maintain and one annoying bug in IE 6).</p>
<p>While I was searching for a new technique I came across one which already came quite close: <a href="http://www.456bereastreet.com/archive/200705/creating_bulletproof_graphic_link_buttons_with_css/">Creating bulletproof graphic link buttons with CSS</a></p>
<p>But this technique has a few drawbacks:</p>
<ul>
<li>Additional to one big background image with all of the necessary elements in it, it also uses a second one just for the corners.</li>
<li>It cannot handle fancy backgrounds.</li>
<li>It doesn&#8217;t allow nesting of elements with rounded corners.</li>
<li>Using the same technique for other elements needs adjusting.</li>
<li>No fancy hover effects are possible.</li>
</ul>
<p>So, I fiddled around with it and improved and enhanced it. Here is how:</p>
<div id="attachment_108" class="wp-caption alignleft" style="width: 230px"><img class="size-full wp-image-108 "  src="http://blog.selfthinker.org/wp-content/uploads/2009/03/original.png" alt="" width="220" height="90" /><p class="wp-caption-text">The original solution</p></div>
<h3>0. The Original</h3>
<p>I won&#8217;t repeat what Roger Johansson wrote in his <a href="http://www.456bereastreet.com/archive/200705/creating_bulletproof_graphic_link_buttons_with_css/">original article</a>. I recommend reading it first to understand what I&#8217;m talking about.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/0__the_original.html">Step 0: The Original (Demo)</a></p>
<h3>1. One Background Image</h3>
<p>The first thing I wanted to get rid of is this strange second background image. Although the <code>corner.gif</code> image contains all of the four corners with a lot of transparent space in between them, the original technique uses it only for the top right and bottom right corner. So, at least 90% of that image is not really needed.</p>
<p>I soon noticed that the bottom right corner does not need to use <code>corner.gif</code>, but can use the normal <code>button.gif</code> just like the rest. So, the only thing to fix was the top right corner.</p>
<p>Every other corner is easy to position because each previous element has a padding exactly where the following element cannot overlap the previous corner. The only tricky bit is the first corner that isn&#8217;t &#8220;protected&#8221; by a previous padding: the top left one. To &#8220;protect&#8221; the top left corner nonetheless, I just gave the first span a left margin, which I removed again from the second span with a negative margin of the same value. <span lang="fr">Et voilà</span>, no second image needed.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/1__one_background_image.html">Step 1: One Background Image (Demo)</a></p>
<h3>2. One Span Less</h3>
<p>Then I wondered: Why are there <strong>five</strong> background image placements and not <strong>four</strong>? The last innermost span has the background strangely attached to &#8220;right center&#8221;. And sure enough, I could safely delete the last span and thus could get rid of one unneeded span (13 characters per rounded element after all).<br />
The padding from that deleted span is plainly added to the preceding span.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/2__one_span_less.html">Step 2: One Span Less (Demo)</a></p>
<h3>3. Fancier Background</h3>
<p>Why should it be &#8220;tricky to give the button a non-flat background colour&#8221;? Mainly because the last, innermost span defines what the major part of the button looks like. Only because the original version chose that to be from the bottom right (and therefore without the 6px on the top and on the left) it is difficult to use an image with a gradient higher than 6px. It could use a much bigger gradient on the bottom without any problems, though.</p>
<p>But as gradients are mostly found at the top, I  simply turned the order around from &#8220;top left &gt; top right &gt; bottom left &gt; bottom right&#8221; to &#8220;bottom left &gt; bottom right &gt; top left &gt; top right&#8221;. And now you can have much higher gradients (as high as the container could get minus the 6px at the bottom).</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/3__fancier_background.html">Step 3: Fancier Background (Demo)</a></p>
<h3>4. Rearrangement</h3>
<p>Then I rearranged the code a bit, basically to removed things unrelated to the link nature from <code>.button:link</code>, etc and to move every occurrence of the background image to one single line, so that it&#8217;s easier to exchange.</p>
<p>I also fixed a bug in IE 6 introduced with the fancier background changes: IE 6 doesn&#8217;t like a bottom padding on the now innermost span.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/4__rearrangement.html">Step 4: Rearrangement (Demo)</a></p>
<h3>5. Hover</h3>
<p>With those changes it is much easier to exchange the background image on hover with just a few more lines of code.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/5__hover.html">Step 5: Hover (Demo)</a></p>
<h3>6. Hoverissimo</h3>
<p>Some time ago my boss wished a link button that exchanges the gradient on hover from top to bottom. With this technique the only problem was the aforementioned problem that you can either have a link button with its main background at the top or at the bottom. To be able to exchange these background gradient positions, I had to turn the order of the background position around again (as in Step 3) as they were before, but this time only for the hover state.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/6__hoverissimo.html">Step 6: Hoverissimo (Demo)</a></p>
<h3>7. Other Button Types</h3>
<p>Now adding other different button types is a piece of cake: Simply add another class for each new type and give it a different background image (and change the background and font colour accordingly, if necessary).</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/7__other_button_types.html">Step 7: Other Button Types (Demo)</a></p>
<h3>8.More Universal</h3>
<p>Now there are only two problems left: If you plan to use this code not only for link buttons, but also for bigger boxes with block elements, you cannot use the code as it is now. You could just exchange the spans with divs and duplicate each line in the CSS code to accommodate that. But what if you have to use another div in there?</p>
<p>Although I&#8217;ve normally long outgrown the &#8216;classitis&#8217; phase, in this case I think, using classes makes the code much more flexible to use. It reduces the CSS code, but increases the HTML again (by 42 characters per rounded element).<br />
And I normally like to give semantic class names, but here rounded corners itself have no semantic meaning, so I contended myself with giving the classes names that are short and have a functional meaning instead. I also renamed &#8220;button&#8221; to &#8220;rounded&#8221;, because as soon as this technique isn&#8217;t used on a link button, its name would be erroneous.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/8__more_universal.html">Step 8: More Universal (Demo)</a></p>
<div id="attachment_109" class="wp-caption alignright" style="width: 230px"><img class="size-full wp-image-109 " src="http://blog.selfthinker.org/wp-content/uploads/2009/03/new_solution.png" alt="" width="220" height="90" /><p class="wp-caption-text">The new solution</p></div>
<h3>9. Any Container</h3>
<p>Finally, with these former changes it is now possible to use this technique on any container, not only on links or inline elements, but on bigger boxes, too. And these rounded containers can even contain other rounded containers.</p>
<p class="demo"><a href="http://blog.selfthinker.org/wp-content/uploads/2009/03/rounded-corners/9__any_container.html">Step 9: Any Container (Demo)</a></p>
<h3>Final Code</h3>
<p>My final basic code (without the &#8220;hoverissimo&#8221; code for the sake of brevity):</p>
<pre>&lt;a class="rounded &lt;type&gt;" href="#"&gt;
  &lt;span class="i1 bg"&gt;&lt;span class="i2 bg"&gt;&lt;span class="i3 bg"&gt;
    Link
  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/a&gt;

&lt;div class="rounded &lt;type&gt;"&gt;
  &lt;div class="i1 bg"&gt;&lt;div class="i2 bg"&gt;&lt;div class="i3 bg"&gt;
    &lt;p&gt;Block level content&lt;/p&gt;
  &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<pre>.rounded,
.rounded .bg {
  background-repeat: no-repeat;
  display: block;
}
.rounded {
  float:left;
  background-position:left bottom;
}
.rounded .i1 {
  padding:0 0 9px;
  background-position:right bottom;
  margin-left: 6px;
}
.rounded .i2 {
  padding:0 0 0 6px;
  background-position:left top;
  margin-left: -6px;
}
.rounded .i3 {
  padding:9px 12px 0 6px /* no bottom padding because of IE6 */;
  background-position:right top;
}</pre>
<pre>/* for each type */
.&lt;type&gt;,
.&lt;type&gt; .bg {
  background-image: url(&lt;type_image&gt;.gif);
  background-color: &lt;type_background_colour&gt;;
  color: &lt;type_font_colour&gt;;
}
/* for hover effect on links */
a.&lt;type&gt;:hover,
a.&lt;type&gt;:hover .bg {
  background-image: url(&lt;type_hover_image&gt;.gif);
}
/* left out :link, :visited, :active and :focus state
   for documenting purposes and readability */</pre>
<div id="attachment_107" class="wp-caption aligncenter" style="width: 625px"><img class="size-full wp-image-107 " src="http://blog.selfthinker.org/wp-content/uploads/2009/03/new_solution_box.png" alt="" width="615" height="314" /><p class="wp-caption-text">The final result: The same technique for the box and the link button within</p></div>
<p>I called this technique <strong>&#8220;Sliding Doors Squared&#8221;</strong>, because it is basically an enhanced version of the <a href="http://www.alistapart.com/articles/slidingdoors/">Sliding Doors technique</a>. Although this technique is great and recommended for two rounded corners with a flexible width or four rounded corners with a fixed width, it cannot be used for completely flexible rounded corners. The &#8220;Sliding Doors Squared&#8221; technique uses the Sliding Doors technique not only horizontally, but also vertically and therefore fills this gap.</p>
<p>Despite all its advantages, there are some disadvantages:</p>
<ul>
<li>the background image has to be rather large (the maximum width and height of the container are defined by the width and height of the background image)</li>
<li>CSS sprites cannot be used for hover effects (at least not before CSS3), so there will be two requests and a flicker at first</li>
<li>the corners must not be transparent</li>
</ul>
<p>As yet I have tested this technique in <strong>IE 6, IE 7, Firefox 3, Opera 9 and Chrome</strong> and it behaves very well so far without any differences or even hacks (no, not even for IE 6!).</p>
<p>For just two rounded corners or simple four rounded corners with a fixed width this might be overkill. <strong>But as soon as you need more flexibility or need an easy way to use drop shadows, fancy borders, gradients or link states, this is the ultimate technique to use.</strong></p>
<p>PS: After I finished the code I took a look at the comments for the original article and realised that the first two steps were already solved in there. That could have saved me about 30 minutes, but at least playing with the code got me going further.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.selfthinker.org/2009/03/29/sliding-doors-squared/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

