Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rotate text/div 90 degrees (static)

Tags:

jquery

css

Needing a cross browser method to rotate a div 90 degrees, and all elements within are rotated accordingly. This is for a static placement (not an animation).

Best practice?

like image 752
Jason Avatar asked Feb 09 '26 16:02

Jason


2 Answers

You can use CSS to rotate the contents of a div:

/* FF Chrome Opera etc */
-webkit-transform: rotate(90deg); 
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
/* IE */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);

edit Added Opera CSS

like image 58
johnny_bgoode Avatar answered Feb 12 '26 05:02

johnny_bgoode


If anyone is stuck trying to implement this in IE8, try the following CSS:

writing-mode: vertical-lr;
-ms-writing-mode: bt-lr; /* IE8 */

https://msdn.microsoft.com/en-us/library/ie/ms531187%28v=vs.85%29.aspx

It worked for me! :)

like image 22
Ben Avatar answered Feb 12 '26 04:02

Ben



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!