Search code examples
jquery-svg

Rotated Element Height and Width


I have a text element with textContent "Design", that was transformed with css to be rotated 45 degree. So it get rotated, but the problem is how to get the height of the rotated element. pls refer the img

Rotated

Initial Position

I need the height and width of the box containing the text

Thanks Gowri


Solution

  • Check This overflow for a pretty good solution. The bounding box will be the outside dimensions of your rotated object.

    EDIT: I should add, this is essentially the same answer as above, but it gives you a bunch of other metrics to go along with your rudimentary bounding box.