I don't get it ;-(
I want to center a div with a text contained in another div. The inner div is rotated by 90 degres. So far so good. My problem is that I can't get the inner div to align horizontal to the left of the outer div. How can this be done?
Here is the fiddle
HTML:
<div class="outer">
<div class="inner">
12345678901234567890
</div>
</div>
CSS:
div {
border: 1px solid red;
}
.outer {
position: absolute;
top: 0px;
height: 300px;
width: 30px;
}
.inner {
transform: translateX(-50%) translateY(-50%) rotate(90deg);
margin-left: 10px;
position: relative;
top: 50%;
text-align: center;
}
Set the inner div to position:absolute
too.
http://jsfiddle.net/r4vrf7pg/8/
div {
border: 1px solid red;
}
.outer {
position: absolute;
top: 0px;
height: 300px;
width: 30px;
}
.inner {
transform: translateX(-50%) translateY(-50%) rotate(90deg);
margin-left: 10px;
position: absolute;
top: 50%;
text-align: center;
}
<div class="outer">
<div class="inner">
12345678901234567890
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With