<bdo id='uGd5L'></bdo><ul id='uGd5L'></ul>
<i id='uGd5L'><tr id='uGd5L'><dt id='uGd5L'><q id='uGd5L'><span id='uGd5L'><b id='uGd5L'><form id='uGd5L'><ins id='uGd5L'></ins><ul id='uGd5L'></ul><sub id='uGd5L'></sub></form><legend id='uGd5L'></legend><bdo id='uGd5L'><pre id='uGd5L'><center id='uGd5L'></center></pre></bdo></b><th id='uGd5L'></th></span></q></dt></tr></i><div id='uGd5L'><tfoot id='uGd5L'></tfoot><dl id='uGd5L'><fieldset id='uGd5L'></fieldset></dl></div>

  • <small id='uGd5L'></small><noframes id='uGd5L'>

  • <legend id='uGd5L'><style id='uGd5L'><dir id='uGd5L'><q id='uGd5L'></q></dir></style></legend>

    1. <tfoot id='uGd5L'></tfoot>

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

        时间:2023-07-31

          • <legend id='dqF06'><style id='dqF06'><dir id='dqF06'><q id='dqF06'></q></dir></style></legend>
          • <i id='dqF06'><tr id='dqF06'><dt id='dqF06'><q id='dqF06'><span id='dqF06'><b id='dqF06'><form id='dqF06'><ins id='dqF06'></ins><ul id='dqF06'></ul><sub id='dqF06'></sub></form><legend id='dqF06'></legend><bdo id='dqF06'><pre id='dqF06'><center id='dqF06'></center></pre></bdo></b><th id='dqF06'></th></span></q></dt></tr></i><div id='dqF06'><tfoot id='dqF06'></tfoot><dl id='dqF06'><fieldset id='dqF06'></fieldset></dl></div>
            • <bdo id='dqF06'></bdo><ul id='dqF06'></ul>
              <tfoot id='dqF06'></tfoot>
                  <tbody id='dqF06'></tbody>

                  <small id='dqF06'></small><noframes id='dqF06'>

                  本文介绍了HTML 的 width/height 属性和 img 元素上的 CSS width/height 属性有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  HTML <img> 元素可以有 width/height 属性,也可以有 CSS width/高度属性:

                  The HTML <img> element can have the width / height attribute, and it can also have the CSS width / height properties:

                  <img src="xxx.img" width="16" height="16"
                  style="width: 16px; height: 16px"></img>
                  

                  HTML属性和CSS属性有什么区别,应该有同样的效果吗?

                  What's the difference between the HTML attribute and CSS property and should they have the same effect?

                  推荐答案

                  关于这个话题的热议可以在这里找到:图片标签与 CSS 的宽度属性

                  A hot debate about the subject can be found here: Width attribute for image tag versus CSS

                  总结一下:

                  声明宽度值和高度值(可能不是图像的原始物理尺寸)或css声明(如宽度:[valueX];高度:[valueY];)的好处是它有帮助加快页面的渲染速度.浏览器知道为页面的特定区域分配多少空间:它甚至会在第一次绘制、第一次解析+页面渲染时绘制图像占位符.当没有定义任何宽度和高度时,浏览器必须下载图像,然后计算其尺寸,分配空间,然后重新绘制页面.

                  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.

                  在我看来,这似乎是最有益的效果.

                  This seems to be the most beneficial effect in my opinion.

                  这篇关于HTML 的 width/height 属性和 img 元素上的 CSS width/height 属性有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何取消加载图像 下一篇:关闭封闭 &lt;p&gt;CKEditor 3.0 中的标签

                  相关文章

                1. <small id='AFE5g'></small><noframes id='AFE5g'>

                  1. <tfoot id='AFE5g'></tfoot>
                      • <bdo id='AFE5g'></bdo><ul id='AFE5g'></ul>
                      <i id='AFE5g'><tr id='AFE5g'><dt id='AFE5g'><q id='AFE5g'><span id='AFE5g'><b id='AFE5g'><form id='AFE5g'><ins id='AFE5g'></ins><ul id='AFE5g'></ul><sub id='AFE5g'></sub></form><legend id='AFE5g'></legend><bdo id='AFE5g'><pre id='AFE5g'><center id='AFE5g'></center></pre></bdo></b><th id='AFE5g'></th></span></q></dt></tr></i><div id='AFE5g'><tfoot id='AFE5g'></tfoot><dl id='AFE5g'><fieldset id='AFE5g'></fieldset></dl></div>
                      <legend id='AFE5g'><style id='AFE5g'><dir id='AFE5g'><q id='AFE5g'></q></dir></style></legend>