This question already has an answer here:
(这个问题在这里已有答案:)
(如何自动调整图像大小以适合“div”容器?)
(31个答案)
Is there a way to resize (scale down) images proportionally using ONLY CSS?
(有没有办法使用ONLY CSS按比例调整大小(缩小)图像?)
I'm doing the JavaScript way, but just trying to see if this is possible with CSS.
(我正在做JavaScript方式,但只是想看看CSS是否可行。)
To resize the image proportionally using CSS:
(要使用CSS按比例调整图像大小:)
img.resize { width:540px; /* you can use % */ height: auto; }
2.1m questions
2.1m answers
60 comments
57.0k users