Fluid image resizing in CSS (or JS?)

2019-09-03 11:43发布

I'm trying to show a fairly large image on a page on my site. I want it to be re-sized dynamically depending on the user's resolution, so that it takes up the same percentage of screen on every monitor. How would I do that?

2条回答
祖国的老花朵
2楼-- · 2019-09-03 12:40

Set image width to a percentage.

查看更多
做个烂人
3楼-- · 2019-09-03 12:43

Use the percentage values rather than pixels:

<img src="path here" width="100%" />
查看更多
登录 后发表回答