How can I wrap a container around its css-transformed contents?

◇◆丶佛笑我妖孽 提交于 2019-12-14 03:42:33

问题


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

JSFiddle Example

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:


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.



来源:https://stackoverflow.com/questions/14246982/how-can-i-wrap-a-container-around-its-css-transformed-contents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!