how to display text vertical inside div tag with css in HTML

Display Text vertically in HTML div tag
I have a div tag which contains text and I want to display the contents of this div vertically.
sam_netAsked:
Who is Participating?
 
sam_netAuthor Commented:
After using below css code , its was working fine...


    .clsHorizLR { -ms-writing-mode:lr-tb }
    .clsHorizRL { -ms-writing-mode:rl-tb }
    .clsVertTB  { -ms-writing-mode:tb-rl }
    .clsVertBT  { -ms-writing-mode:bt-rl }
0
 
Ioannis ParaskevopoulosCommented:
Hi,

Have a look at this fiddle:
fiddle

Giannis
0
 
Ioannis ParaskevopoulosCommented:
Hi,

This is a nicer example:
http://jsfiddle.net/9Ube2/3/

Giannis
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Rose BabuSenior Team ManagerCommented:
try like this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>    
    <title>Vertical Text Test</title>
    <style type="text/css">
        h1 span
        {
            display: block;
        }
    </style>
</head>
<body>
    <h1>
        y-axis
    </h1>

    <script type="text/javascript">
        var h1 = document.getElementsByTagName('h1')[0];
        h1.innerHTML = '<span>' + h1.innerHTML.split('').join('</span><span>') + '</span>';
    </script>

</body>
</html>

Open in new window

0
 
sam_netAuthor Commented:
Thanks for your inputs...
Actually it was displayed from top to bottom
T
e
s
t

But i need to display  from bottom to top
t
e
s
T
0
 
Ioannis ParaskevopoulosCommented:
Hi,

Look at this fiddle:
http://jsfiddle.net/9Ube2/4/

Giannis
0
 
Rose BabuSenior Team ManagerCommented:
Try this updated script.

<script type="text/javascript">
	var h1 = document.getElementsByTagName('h1')[0];
	//h1.innerHTML = '<span>' + h1.innerHTML.split('').join('</span><span>') + '</span>';
	var verSplitStr = h1.innerHTML.replace(/^\s+/, '').replace(/\s+$/, '').split("");
	var verStr = "";

	for (var i = verSplitStr.length-1; i >= 0; i--) {
		verStr = verStr + "<span>" + verSplitStr[i] + "</span>";
	}
	h1.innerHTML = verStr;

</script>

Open in new window

0
 
sam_netAuthor Commented:
This issus was solved..
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.