I want to rotate some text for vertical display (y-axis chart label). The text can have any variable length (but always on the same line).
I tried to rotate using CSS3 transforms (see JSFiddle ):
.rotate { transform: rotate(270deg); }
However, the original width and height of the element are preserved even after rotation, as described in the specification :
In the HTML namespace, the transform property does not affect the flow of content surrounding the transformed element.
This means that the width of the element container expands depending on the length of the label text, affecting the position of the adjacent chart.
How do I rotate text and squeeze its container to a new width? Any solution would be helpful, including JavaScript / jQuery solutions or alternative approaches.
source share