Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 重置高度:img元件上的自动_Html_Css_Image - Fatal编程技术网

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样式表上的样式。你可以找到一篇好文章