HTML widthheight属性和img元素上的CSS widthheight属性有什么区别?

HTML widthheight属性和img元素上的CSS widthheight属性有什么区别?,第1张

概述HTML< img>元素可以具有width / height属性,并且还可以具有CSS width / height属性. <img src="xxx.img" width="16" height="16" style="width: 16px; height: 16px"></img> HTML属性和CSS属性有什么区别,应该具有相同的影响? 关于这个问题的热门辩论可以在这里找到: Width HTML< img>元素可以具有wIDth / height属性,并且还可以具有CSS wIDth / height属性.
<img src="xxx.img" wIDth="16" height="16" ></img>

@R_419_6832@属性和CSS属性有什么区别,应该具有相同的影响?

解决方法 关于这个问题的热门辩论可以在这里找到: Width attribute for image tag versus CSS

把它们加起来:

The gain from declaring a wIDth value
and an height value (which may not be
the original physical dimensions of
the image) or from CSS declarations
(like wIDth: [valueX]; height:
[valueY];) is that it helps speed up
the rendering of the page. The browser
kNows how much space to allocate a
particular area of the page: it will
even draw image placeholders on a
first draw,a first parsing+rendering
of the page. When one does not define
any wIDth and height,then the browser
has to download the image and then
figure out its dimensions,space to
allocate and then redraw the page.

这似乎是我看来最有利的效果.

总结

以上是内存溢出为你收集整理的HTML width / height属性和img元素上的CSS width / height属性有什么区别?全部内容,希望文章能够帮你解决HTML width / height属性和img元素上的CSS width / height属性有什么区别?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1094535.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存