简体   繁体   English

缩小容器中的所有物品

[英]Making all items inside a container smaller

I have a webpage where all items on the page are inside a container but I would like to make everything smaller by 25%. 我有一个网页,其中页面上的所有项目都在容器内,但我希望将所有内容缩小25%。 I have tried: 我努力了:

Container.CSS 容器

.container{
     transform: scale(0.75);
}

But this technique shrinks the entire page making it about 2 inches offset from the top of the screen, and also makes all the items on the page blurry. 但是这种技术会缩小整个页面,使其距屏幕顶部大约2英寸,并且还会使页面上的所有项目变得模糊。

Question. 题。 Does anyone know a quick and easy way to do what I want to do, or will I have to individually make every item in the CSS 25% smaller? 有谁知道一种快速简便的方法来完成我想做的事情,还是我必须将CSS中的每个项目分别缩小25%?

Thanks 谢谢

Since you haven't uploaded any code for us to edit, all I can say is that I would give the main page container or body a width of 75%, and then make every element inside have percentual widths, so they stay responsive. 由于您尚未上传任何代码供我们编辑,因此,我只能说要给主页容器或主体一个75%的宽度,然后使其中的每个元素都具有百分比宽度,以便它们保持响应状态。

But as you noted the transform: scale(0.75); 但是正如您注意到的transform: scale(0.75); solution, I conclude you also want the font, borders, etc to shrink. 解决方案中,我得出结论,您还希望缩小字体,边框等。 Your best solution is to convert the px values to em values (generally speaking 16px = 1em ) for those things, and then change the body's font-size to 75%, shrinking everything in the page, because 1em has then become 12px. 最好的解决方案是将这些值的px值转换为em值(通常来说为16px = 1em ),然后将正文的字体大小更改为75%,缩小页面中的所有内容,因为1em然后变为12px。

Might take some time, but when you're done, your whole page has been made dynamic 可能要花一些时间,但是完成后,整个页面就变得动态了

Hope this helps 希望这可以帮助

If responsive design so easy, all non-mobile friendly sites could be fixed in 1 minute. 如果响应式设计如此简单,那么所有非移动友好站点都可以在1分钟内修复。 But it's not that way I'm afraid. 但是,恐怕不是那样的。

The individual items would need to have percentage widths on them. 单个项目将需要在其上具有百分比宽度。 Using max-width with percentage widths is good too. 将max-width与百分比宽度一起使用也很好。 For example you would have your main container set at 75% and a max-width of whatever the maximum your graphics can take inside. 例如,您将主容器设置为75%,最大宽度设置为图形可以容纳的最大宽度。 If your items inside have % widths then the one at 25% will always be 25% of whatever size the container is. 如果内部物品的宽度为%,那么25%的物品将始终是容器尺寸的25%。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM