Within the article I linked to, the example uses an image sprite and a sprinkle of CSS to get things positioned right. Well, maybe not so much a sprinkle. It's like the top fell off the pepper shaker and you've suddenly got a large pile of pepper on your food. It makes me want to sneeze.
Thankfully, many of the popular browsers of today support the ability to rotate HTML elements. Even better? We can make it work in Internet Explorer (back to version 5.5 even). How you might ask? Okay, let's look at the HTML.
<div class="example-date">
<span class="day">31</span>
<span class="month">July</span>
<span class="year">2009</span>
</div>
The CSS
For Webkit and Firefox (as of 3.5), you can take advantage of the proposedtransform
property to handle the rotation. Each browser requires its property prefix for now.-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
In order to perform a transformation, the element has to be set to display:block
. In this case, just add the declaration to the span that you want to rotate.When it comes to effects in Internet Explorer, there is a surprising amount of power (and untapped at that, I'd say) in using filters. Although misleading, there is a filter called BasicImage that offers up the ability to rotate any element that has layout.
for IE use this -:
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
Nice and clean without too many extras. I conscientiously chose the date order I did to avoid having to use a comma. Otherwise, an extra span would be required to remove the comma from our final design.