HTML / CSS Contol图像大小动态? [英] HTML / CSS Contol image size dynamically?
本文介绍了HTML / CSS Contol图像大小动态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法控制网站上的图片大小?例如如果图像超过640x360,则显示
Is there a way to control image size on the website ? e.g. if the image exceeds 640x360 then display it with
<img src="image.jpg" width="640" height="360" />
但是如果图像小于例如256x256然后使用其原始高度和宽度显示它。
but if the image is less than that e.g. 256x256 then display it using its native height and width.
<img src="image.jpg" width="native" height="native" />
感谢您的帮助。
推荐答案
不会
img {max-width:640px;}
是最简单的答案
这篇关于HTML / CSS Contol图像大小动态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文