csstext-rotation

Text rotated by 90° using only CSS


Is it possible to rotate text by 90° (clockwise or counter-clockwise) using only CSS and compatible with IE6+, Firefox 2 and Opera?


Solution

  • How can I draw vertical text with CSS cross-browser?

    .rot-neg-90 {
      /* rotate -90 deg, not sure if a negative number is supported so I used 270 */
      -moz-transform: rotate(270deg);
      -moz-transform-origin: 50% 50%;
      -webkit-transform: rotate(270deg);
      -webkit-transform-origin: 50% 50%;
      -o-transform: rotate(270deg);
      -o-transform-origin: 50% 50%;
      transform: rotate(270deg);
      transform-origin: 50% 50%;
    
      /* IE<9 */
      filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
    

    IE<9 Rotation property for BasicImage filter.