Solved

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

Posted on 2013-05-16
8
512 Views
Last Modified: 2013-05-23
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.
0
Comment
Question by:sam_net
  • 3
  • 3
  • 2
8 Comments
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39171128
Hi,

Have a look at this fiddle:
fiddle

Giannis
0
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39171173
Hi,

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

Giannis
0
 
LVL 16

Expert Comment

by:Rose Babu
ID: 39171196
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
 

Author Comment

by:sam_net
ID: 39172085
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39173012
Hi,

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

Giannis
0
 
LVL 16

Expert Comment

by:Rose Babu
ID: 39173949
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
 

Accepted Solution

by:
sam_net earned 0 total points
ID: 39177254
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
 

Author Closing Comment

by:sam_net
ID: 39190262
This issus was solved..
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now