ᔕᖺᘎᕊ
ᔕᖺᘎᕊ

Reputation: 3011

Rotate a div next to a floated div

I have this layout: (also a JSFiddle here)

.rotate {
  transform: rotate(270deg) translate(-10em, 0);
  transform-origin: 0 0;
  float: left;
}

.left {
  float: left;
}
<div class='rotate'>
  Rotated
</div>
<div class='left'>
  Some content....
  <br> Some content....
  <br> Some content....
  <br> Some content....
  <br> Some content....
  <br>
</div>

I am trying to get the .rotate div to be right next to the .left div, however I can't.

I've tried...

How do I get a div to rotate alongside a left-floated div?

Upvotes: 0

Views: 561

Answers (1)

Wowsk
Wowsk

Reputation: 3675

Just change the transform-orgin of the rotated div and also remove the translate from that element.

.rotate {
  transform: rotate(270deg);
  transform-origin: 100% 100%;
  float:left;
}

.left {
  float: left;
}
<div class='rotate'>
  Rotated
</div>
<div class='left'>
  Some content....
  <br> Some content....
  <br> Some content....
  <br> Some content....
  <br> Some content....
  <br>
</div>

Upvotes: 2

Related Questions