How to scale so that container also grows and takes up space

前端 未结 6 1870
傲寒
傲寒 2020-12-17 07:44

So I have a container that I want to scale up and down (zoom in and out) but to also have its expanded/shrunk form to take up space rather than just overlapping other stuff.

6条回答
  •  Happy的楠姐
    2020-12-17 08:15

    I would use other attributes than scale, that unlike scale affect the flow. You could change the div's height, width, margin, padding, font-size etc.

    Edit: If you really want to use scale to change the size of everything inside the element in a uniform way, you could have an outer element which you change width and height of, and an inner element that you change scale on to match the outer elements width and height. The outer element will affect the flow of the content. But I don't really think this is desirable as it's not going to look that nice anyway if you just scale up all eventual icons and text inside the container, you probably want to keep a lot of elements inside the container at the same size regardless of the container's size.

提交回复
热议问题