作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有尺寸为 (900x512) 的图像。因为我要让它响应,所以图像需要在保持宽高比的屏幕宽度内进行调整!!
最佳答案
使用:
<img src="..." style="width: 100%; height: auto;" />
这将保持纵横比。 height: auto
将确保 height
未在其他地方设置(如 cale_b 所述)
关于javascript - 使用 CSS 或 jQuery 保持图像的纵横比?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33945388/
我有一张 table 。我希望它的数据垂直和水平居中。 我使用了 align="center"valign="middle" ,但它没有用。
我是一名优秀的程序员,十分优秀!