Home > Net >  Resize image according to the page scale
Resize image according to the page scale

Time:07-09

When I change the scale of the current page using "ctrl & " or "ctrl & -", I want my image ('img' tag) to change its size accordingly.
How can I do it?

CodePudding user response:

Use vh & vw units for your Image in css.

img{
width:50vh;
height:50vh;
/* your css*/
}

more details on css units

CodePudding user response:

The easiest way to do it is to set the width of the image to 100%;

Or you can use media queries.

More about media queries: https://www.w3schools.com/cssref/css3_pr_mediaquery.asp

  • Related