I have been attempting to create an information box that contains a simple info text div. On the right side of this info box, I want to include a text labeled "more info" within a nested div to signify that the info box is interactive. To save space, I would like to rotate the text by 90 degrees so that it only takes up as much space as the height of the text "more info". However, I have been struggling to achieve this. When I try to rotate the text, it either breaks into two lines or is not vertically centered despite using white-space: nowrap;
.
Does anyone have any suggestions for alternative CSS properties I could experiment with?
I have created a fiddle to demonstrate the issue: https://jsfiddle.net/girlscout/9e5u3j5w/3/
In this example, I have colored the two divs differently for clarity on their behavior.
Special thanks to Brett for the code snippet suggestion. Here is the code:
.first-div {
border:1px solid blue; width:300px; height:100px; margin:20px auto;
display:flex;
}
.second-div {
background-color:green;
}
.mytext{
transform:rotate(-90deg);
/*white-space: nowrap;*/
}
<div class="first-div">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa sociis nato.
</p>
<div class="second-div"><p class="mytext">more info</p></div>
</div>