tags:

views:

63

answers:

3

I would like to have a div with some text in it. But I'd like the text to flow vertically instead of horizontally. Like this;

M

y

t

e

x

t

Any ideas on how to accomplish this with CSS?

+2  A: 

If you have only one line of text you could try using width:1em;letter-spacing:1px (and a space between each letter)

edit: if you want to use no space between each letter width:1em;letter-spacing:1em;word-wrap:break-word

Knu
Did not work I'm afraid. :(
Confused
try with 0.9em and add a space between each letter (or use a custom letter-spacing) // check my update
Knu
Yes well a space between each letter kind of defeats the whole purpose, of course it'll work with a space between each letter. :(
Confused
Did you try to combine it with "word-wrap: break-word"? Note that this will only work in IE and CSS3-compatible browsers.
Prutswonder
@pruts edited before seeing your comments ^^
Knu
That worked, very nice. Thank you!
Confused
(click on the checkmark to accept the answer)
Knu
+1  A: 

CSS3 has a proposed 'writing-mode' attribute that can be set to 'tb-lr' (write text from top to bottom, write lines from left to right), but I don't know if any browsers support it yet, so its not something to rely on.

swestrup
yes it's IE only afaik
Knu
The IEs support writing-mode, but other browsers do not yet.
ajm
+1  A: 
.yourtext { -moz-transform: rotate(-90deg);
            -webkit-transform: rotate(-90deg);
            -moz-transform-origin: top right;
            -webkit-transform-origin: top right;
            filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
Victor Jalencas