我的 html 在下面。
<img src="something" alt="" width="1px" height="1px" border="0" />
我认为它显示 1px × 1px 的图像。 但实际上代码显示如下。
<img src="something" alt="" border="0" width="438" height="438" srcset="something?zoom=1.25&resize=438%2C438&" src-orig="something?resize=1%2C1&" scale="1.25">
为什么会出现错误? 为什么我的网站上不显示 1px × 1px 的图像? 请帮帮我...
最佳答案
不要写 px
试试这个:
<img src="http://lorempixel.com/output/abstract-q-c-640-480-7.jpg" alt="" width="1" height="1" border="0" />
实际上它也应该与 px
一起工作。那么,您的代码无法正常工作的原因可能是您用其他一些 CSS
或 javascript
覆盖了规则。如果 CSS
和/或 javascript
仍然无法正常工作,请关闭它并查看原因。
如果你添加了 CSS 规则,请看这里它不会起作用:
img {
width: 100%;
height: 500px;
}
<img src="http://lorempixel.com/output/abstract-q-c-640-480-7.jpg" alt="" width="1" height="1" border="0" />
关于html - html中img的宽度和高度不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42136909/