Fluid image resizing in CSS (or JS?)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 14:22:25

问题


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?


回答1:


Use the percentage values rather than pixels:

<img src="path here" width="100%" />



回答2:


Set image width to a percentage.



来源:https://stackoverflow.com/questions/3285302/fluid-image-resizing-in-css-or-js

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