I have been trying text to go in a vertical direction like we can do in ms-word tables but so far I have only been able to do THIS... which I am not happy with because it's a box rotated... Isn't there a way to have actual vertical direction text?
I only set the rotation to 305 degrees in the demo which doesn't make the text vertical. 270deg
will but I only made the demo to show rotation.
I've manage to have a working solution with this :
(I have a title within a middleItem class div)
I was searching for an actual vertical text and not the rotated text in HTML as shown below. So I could achieve it by using the following method.
HTML:-
CSS:-
JSFiddle! Demo.
Update:- If you need the whitespaces to be displayed, then add the following property to your css.
white-space: pre;
So, the css class shall be
JSFiddle! Demo With Whitespace
Update 2 (28-JUN-2015)
Since
white-space: pre;
doesnt seem to work (for this specific use) on Firefox(as of now), just change that line towhite-space: pre-wrap;
So, the css class shall be
JsFiddle Demo FF Compatible.
To display text in vertical (Bottom-top) we can simply use:
Note we can add this to ensure Browser Compatibility:
we can also read more about
writing-mode
property here on Mozilla docs.This is a bit hacky but cross browser solution which requires no css
rotation, like you did, is the way to go - but note that not all browsers support that. if you wan't to get a cross-browser solution, you'll have to generate pictures for that.
Here is an example of some SVG code I used to get three lines of vertical text into a table column heading. Other angles are possible with a bit of tweaking. I believe most browsers support SVG these days.