Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why can't I move this div after rotating?

I have a <div> that I would like rotated and moved all the way to the left (like when using left:0). I have been able to rotate it so that my text is sideways as I want it, but it should be moved to the left of the screen.

I have tried using left:0 but it seems to do nothing.

My HTML is as follows :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<div id="Menu" style="">This is a test. This text should be on the left side of the page.</div>

And my CSS is…

#Menu
{
width:100vh;
height:2vw;
background-color:#336699;
transform: rotate(-90deg);
}  

What am I missing in order to move this to the left side of the screen? I have created a jsfiddle in order to demonstrate this further. https://jsfiddle.net/px0sabgr/

>Solution :

You need to change the transform origin to the left-center, and include a translate in the X direction with a value of -100%.

#Menu {
  width: 100vh;
  height: 2vw;
  background-color: #336699;
  transform-origin: left center;
  transform: rotate(-90deg) translateX(-100%);
}
<div id="Menu" style="">This is a test. This text should be on the left side of the page.</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading