views:

6748

answers:

4

Hi, i want to rotate a single word of text by 90 degrees cross-browser (>= ie6, >= ff2, webkit).

+8  A: 

For FF 3.5 or Safari/Webkit 3.1, check out: -moz-transform (and -webkit-transform). IE has a Matrix filter(v5.5+), but I'm not certain how to use it. Opera has no transformation capabilities yet.

.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%;
  /* IE support too convoluted for the time I've got on my hands... */
}
The Wicked Flea
thanks, but ff 2 would look horrible.
usr
FF2 wouldn't do anything, it doesn't interpret -transform.
The Wicked Flea
so the vertical menu would be extremely wide.
usr
+1 for the ghost bear icon ;)I had a good deal of trouble making this work, I ended up having to change my DOM structure and fudging with a negative margin. An IE version that's simpler to use but doesn't look right when the page is printed out: writing-mode: tb-rl; filter: flipv fliph;
RMorrisey
+1  A: 

Vertical text crossbrowser is not so difficult. On the dns4.nl there is a solution that works even in opera. I tested it with all versions ie, mozilla and safari (also crown). the link is: http://www.dns4.nl/pagina/html_code/vertikale_tekst.html.

comment for xkcd150:

Problem is, that's relying on the canvas element. – xkcd150 Sep 20 at 10:13

No, the procedure isn't relying on the canvas element.

bobik
Problem is, that's relying on the canvas element.
xkcd150
+1  A: 

I adapted this from http://snook.ca/archives/html_and_css/css-text-rotation :

<style>
    .Rotate-90
    {
        display: block;
        position: absolute;
        right: -5px;
        top: 15px;
        -webkit-transform: rotate(-90deg);
        -moz-transform: rotate(-90deg);
    }
</style>
<!--[if IE]>
    <style>
     .Rotate-90 {
      filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
      right:-15px; top:5px;
     }
    </style>
    <![endif]-->
john
+7  A: 

I am using the following code to write vertical text in a page. Firefox 3.5+, webkit, opera 10.5+ and IE

-moz-transform:rotate(-270deg); 
-moz-transform-origin: bottom left;
-webkit-transform: rotate(-270deg);
-webkit-transform-origin: bottom left;
-o-transform: rotate(-270deg);
-o-transform-origin:  bottom left;
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
tchoesang
Works on Chrome 5. Doesn't work on IE 8 "quirks" mode; *does* work on "IE8 Standards mode".
Asaf Bartov
Thanks for letting me know. Please post it here, if you find a way to have vertical Text in IE under quirks mode.
tchoesang