Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rotate text 90 degrees inline

How do I rotate text 90 degrees without using the style sheet? I have placed the following instruction in the header area of the page:

<style>
div.rotate-text {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
</style>

Then I placed the following around the paragraph in question.

<div id="rotate-text">
<p>My paragraph</p>
</div>

But its not working and hence my question.

like image 445
Chris Gedge Avatar asked Nov 13 '17 09:11

Chris Gedge


People also ask

How do I align text 90 degrees in HTML?

To achieve -90 deg text writing-mode: vertical-lr writes text vertically but is basically equivalent to rotating the text 90 degrees. With transform: rotate(180deg) we end up with the -90 degrees look we want.

How do you rotate text in HTML?

Rotate text can be done by using the rotate() function. We can rotate the text in clockwise and anti-clockwise direction. The rotate function can also rotate HTML elements as well.

How do you rotate text vertically in HTML?

To rotate text 90 degrees: -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg);


1 Answers

Here is a small visual example:

#rotate-text {
   width: 25px;
   transform: rotate(90deg);
}
<div id="rotate-text">
  <p>My paragraph</p>
</div>
like image 141
sjahan Avatar answered Oct 08 '22 18:10

sjahan