Layout using vh does not scale with zoom

岁酱吖の 提交于 2019-11-29 14:43:57

The vh and vh units are a measurement relative to the viewport size. 1vh is 1% of the current viewport height, so 100vh is always 100% height. No matter how much you zoom in and out, the viewport is still the same size.

When you zoom in, you scale up the entire document (but not the viewport). It's logical that the space between elements increases as you zoom in the page, if that space is not defined in viewport units as well. Because the other elements don't increase it takes the document out of proportions.

If you want to create elements that scale as you zoom in, try using the rem unit. This is relative to the body's font size, so as you zoom the page in every value expressed in rem will scale accordingly.

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