As per How to properly use css-values viewport-relative-lengths?, I've tried using viewport units in the following way, to automatically magnify a tiny page on a big monitor:
/* automatically magnify business-card-style page in large viewports */
@media (min-width: 50em) and (min-height: 64em) {
/* start with 100% at 50em, we'll have 150% magnification at 75em */
html {font-size: 2vmin;}
}
However, when tested in Google Chrome, it made the zoom feature to mostly stop working.
Is it a bug/feature in Chrome for the zoom to immediately stop working with the above code in place, or is it by design and by the spec?
- CR. Length units representing a percentage of the current viewport dimensions: width (vw), height (vh), the smaller of the two (vmin), or the larger of the two (vmax).
VW is useful for creating full width elements (100%) that fill up the entire viewport's width. Of course, you can use any percentage of the viewport's width to achieve other goals, such as 50% for half the width, etc. VH is useful for creating full height elements (100%) that fill up the entire viewport's height.
Now, can confidently use the REM, EM, VW, and VH units to make perfectly responsive websites.
vmin is the minimum between the viewport's height or width in percentage depending on which is smaller. vmax is the maximum between the viewport's height or width in percentage depending on which is bigger.
AS per definition vw/vh/vmin/vmax are units related to the viewport width:
div{
height: 3rem;
border: 1px solid red;
margin: 1rem;
}
The following div has style="width:10vh"
<div style="width:10vh"></div>
The following div has style="width:10vw"
<div style="width:10vw"></div>
If you see in the example, as you resize the window the divs are changing its width. If you apply zoom but the view port doesn't change size it will not apply any change.
Maybe you have to check any additional property set in the viewport
meta tag in your html header and check if its blocking the way it should scale on zoom. This article could help you to check it https://css-tricks.com/snippets/html/responsive-meta-tag/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With