I am looking to display text vertically (like a y-axis chart label) and need the ability to rotate text of varying lengths while keeping it on one line.
My attempt to achieve this using CSS3 transforms can be seen in this JSFiddle:
.rotate {
transform: rotate(270deg);
}
However, the element's original width and height remains unchanged after rotation, as stated in the specification:
In the HTML namespace, the transform property does not affect the flow of the content surrounding the transformed element.
This causes the container width to expand based on the length of the label text, impacting the position of adjacent charts.
Is there a way to rotate the text and adjust its container size to fit the new width? I welcome any solutions, whether using JavaScript/jQuery or exploring alternative methods.