现在我在定义图像属性的高度和宽度时遇到了一个问题,因为我从服务器上不知道它的维度。然后我考虑将width
/height
分配给auto
。
例如
img {
height: auto;
width: auto;
}
但是我关心的是在没有特定width
/height
的情况下渲染性能图像。我希望这里的前端开发人员能够帮助解决这个问题。
嘿,现在在100%
中定义你的img width
就像这个
<div class="imgtagcss">
<img src="xxx.jpg" >
</div>
Css
.imgtagcss{
width:xxx;
}
.imgtagcss img{
width:100%;
}
Give width and height在css中有100%。因此,当css被加载时,所有的图像标记都将被设置为100%。这不会对性能产生任何影响。