Rotating text using CSS


Rotating text using css only.


Surprisingly IE supports this feature rather well. You could use property filters in IE, but since this is only supported on IE browsers, I would not recommend it.

CSS3, still in proposal state, has a "writing-mode" property for doing this. It has been part of IE's browser engine since IE5.5. Now that it is part of the CSS3 draft specification, would be the best way to implement this going forward.

Webkit based browsers; Firefox 3.5+, Opera 11 and IE9 implement this feature differently by utilizing the transform property.

Without using third-party JavaScript or CSS properties, we can use the CSS3 "writing-mode" property, supported from IE5.5 up to IE8, the latter adding addition formatting options through -ms extensions.

<style type="text/css">

.rightToLeft{ writing-mode: tb-rl; }


<p class="rightToLeft">This is my text</p>

This will rotate the text 90 degrees, starting from the right to the left.

Here are all the options:

·         lr-tb – Default value, left to right, top to bottom

·         rl-tb – Right to left, top to bottom

·         tb-rl – Vertically; top to bottom, right to left

·         bt-rl – Vertically; bottom to top, right to left

·         tb-lr – Available in IE8+: -ms-writing-mode; top to bottom, left to right

·         bt-lr – Bottom to top, left to right

·         lr-bt – Left to right, bottom to top

What about Firefox, Safari, etc.? The following techniques need to be used on Webkit browsers like Firefox, Opera 11, Google Chrome and IE9. These browsers require their proprietary vendor extensions: -moz-, -webkit-, -o- and -ms-.

  • -webkit-transform: rotate(90deg);   
  • -moz-transform: rotate(90deg);
  • -ms-transform: rotate(90deg);
  • -o-transform: rotate(90deg);
  • transform: rotate(90deg);



Print | posted @ Friday, June 24, 2011 11:32 AM

Comments on this entry:

Gravatar # re: Rotating text using CSS
by Qasim at 5/8/2012 4:43 AM

Very nice page! I will use it in my next blog design.
Post A Comment