Html 重置高度:img元件上的自动
我有一个Html 重置高度:img元件上的自动,html,css,image,Html,Css,Image,我有一个img元素,其宽度和高度明确指定: <img src="http://example.com/something.jpg" width="100" height="200" /> 有一个外部样式表可以在所有图像上设置height:auto,它覆盖我预先计算的宽度和高度,并使图像高度为零,直到读取图像标题。这暂时打破了我的布局 有没有办法在img元素上覆盖height:auto <img src="" style="height:200px" /> 加载
img
元素,其宽度和高度明确指定:
<img src="http://example.com/something.jpg" width="100" height="200" />
有一个外部样式表可以在所有图像上设置height:auto
,它覆盖我预先计算的宽度和高度,并使图像高度为零,直到读取图像标题。这暂时打破了我的布局
有没有办法在
img
元素上覆盖height:auto
<img src="" style="height:200px" />
加载页面后,您将删除该文件。尝试
<img src="http://example.com/something.jpg" style="height: 200px!important;" width="100" height="200" />
您应该使用内联样式覆盖css样式表上的样式。你可以找到一篇好文章