I have block wrapper and div inside it. To child I apply CSS rotate, and I want that parent div will change it width and height - child div must be inside parent always (like on pictures).
#wrap {
margin-top: 100px;
width: auto;
height: auto;
position: relative;
border: 1px solid red;
box-sizing: border-box;
}
#div {
position: relative;
top: 0;
left: 0;
background-color: green;
width: 200px;
height: 80px;
display: block;
transform: rotate(120deg);
}
<div id="wrap">
<div id="div">123</div>
</div>
Example: https://jsfiddle.net/y2mw3wxn/
Example how it must be: