Check out the Latest Articles:

The short answer for this blog is:

vertical text tag cloud effect preview

vertical text tag cloud effect preview

-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
writing-mode: tb-rl;

I’ve been working on a very interesting project and one of the desired feature is a fancy tag cloud with variations in color, size, and text alignment. Tricks with color like depth or text sizes are pretty straightforward; however, the vertical & horizontal text alignment is not as easy as his other two fellow requirements buddies.

After digging thru piles of rss reader records, I found css sprite is a good answer. Here’re an article explaining detailed implementations, step by step, and a sample image (upper half demo effect, lower half css sprite compositions).

Vertical text rotation using css sprites

Vertical text rotation using css sprites

However, some brilliant people found a better way by employing css without sprite graphics. Link. He is using

-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);

Explanations to the code: webkit-transform is the Safari core based browser’s support for vertical text, -moz-transform is the Mozilla Firefox counterpart, while the last DXImageTransform is the Microsoft IE Method.

Finally, after looking up into the css 3 standard, I found the lenghty IE vertical text support is trimmed and it is included in the css 3 standard:
writing-mode: tb-rl. Therefore, the final solution is

-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
writing-mode: tb-rl;

I hope my article can be of use to you. :-)

No related posts.



  1. Vandereij on Sunday 18, 2009

    Yes, mate!

    You saved my life. This was the only good answer I found and It worked!
    Thanks

  2. wenbo on Sunday 18, 2009

    very glad it can be of use to you. :-)

  3. dream on Sunday 18, 2009

    Thanks for your post. It is really helpful.

    However it is not working in Mozilla 3.0 version. COuld you please let me know whats the workqaround for this to work in mozilla 3.0 and safari 2.0.

    Thanks again for your help.

  4. wenbo on Sunday 18, 2009

    Thanks for reading. I made a sample file and it passed testing in firefox 3 latest version & safari. Try it out.

    <html>

    <head>
    <title>test vertical css</title>
    <style>
    .v
    {
    font-size:100px;

    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
    </style>
    </head>

    <body>

    <p class="v">
    1231231231231
    </p>
    </body>
    </html>