How to set Zoom % for Certain Browers in HTML?

雨燕双飞 提交于 2019-12-24 13:28:28

问题


In web design, is it possible to automatically set a Zoom % for users based on their web browser?

For instance, a website opened in Opera with 100% Zoom may not look the same if it was opened in Chrome at the same 100% Zoom. However, the website at 100% Opera scales identically with Chrome at 125% Zoom. Is there a way to set Zoom views? Am I being confused with view-port?


回答1:


Well it's considered not good, but in rare cases that you want to increase the scale of an element you can do something like this:

   .zoom {
        -ms-transform: scale(1.2);
        -ms-transform-origin: 50% 0; /* IE */
        -moz-transform: scale(1.2);
        -moz-transform-origin: 50% 0 0;  /* Mozilla */ 
        -webkit-transform: scale(1.2);
        -webkit-transform-origin: 50% 0 0;  /* Chrome, Safari, Opera */
     }



回答2:


Viewport is a way of defining the viewable area (I guess it looks a bit like zooming). But it's a meta tag.

<meta name="viewport" content="width=device-width" />

There is another solution in css (check support or vendor prefixes)

@viewport {
    width: 980px;
    min-zoom: 0.25;
    max-zoom: 5;
    orientation: landscape;
}


来源:https://stackoverflow.com/questions/31764420/how-to-set-zoom-for-certain-browers-in-html

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