开发者

Auto scale image in html tag

开发者 https://www.devze.com 2023-04-13 09:51 出处:网络
Is there a way to get Firefox (or 开发者_运维技巧a browser in general) to scale an image in an HTML image tag automatically depending on the window size, and then expand the image to full size upon cl

Is there a way to get Firefox (or 开发者_运维技巧a browser in general) to scale an image in an HTML image tag automatically depending on the window size, and then expand the image to full size upon clicking on it, in the same way that the browser displays an image if you view it directly (right click and hit view image)?


You can't achieve the part where you want to make the image larger using click without some JS, but if you want the image to scale according to the browser size, you can use this in your CSS stylesheet:

img {
     max-width: 100%;
}

Read more about this here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号