How can I wrap a container around its css-transfor

2020-07-20 07:58发布

When I use scale or rotate, the parent element wraps to the size of the pre-translation dimensions of the element.

JSFiddle Example

Transformed image

Is there any way to wrap the parent container around the bounding box of the transformed element with CSS, or do I need to use Maths to manually position things?

1条回答
乱世女痞
2楼-- · 2020-07-20 08:18

Based on this earlier question it sounds like you will need to use some math and javascript to change the wrapper.

By using the function in the answer you could then set the wrapper dimensions based on the dimensions you just calculated.

查看更多
登录 后发表回答