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

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

        在浏览器布局中为响应式图像保留空间(防止回流)

        reserving space in browser layout for responsive images (preventing reflow)(在浏览器布局中为响应式图像保留空间(防止回流))
          <tbody id='Mxi11'></tbody>

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

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

              <tfoot id='Mxi11'></tfoot>
                <bdo id='Mxi11'></bdo><ul id='Mxi11'></ul>

                  本文介绍了在浏览器布局中为响应式图像保留空间(防止回流)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在进行更改,以使我的网站更具响应性,总的来说,这进展顺利.但是,我遇到了一个问题:

                  I have been making changes to make my site more responsive and, in general, this has gone well. However, I have run into one problem:

                  以前,我总是在 img 元素上使用 height 和 width 属性,以便在浏览器加载图像时在布局中保留空间.这可以防止布局在浏览器中晃动加载并计算图像所需的空间.

                  Before, I always used height and width attributes on img elements in order to reserve space in the layout for the images while the browser loads them in. This prevents the layout from jerking around while the browser loads and calculates the needed space for the image.

                  然而,在使我的图像更具响应性之后,通过使用 max-width: 100% 并取出 height 和 width 属性,浏览器不再为图像保留空间(因为它不再提前知道图像的高度或宽度,因为我无法明确告诉它)

                  After making my images more responsive, however, by using max-width: 100% and taking out the height and width attributes, the browser no longer reserves space for the image (because it no longer knows how tall or wide the image is going to be in advance since I couldn't explicitly tell it)

                  我的目标是让响应式图像在初始加载时也占据页面布局中的适当空间.有谁知道这个的解决方案吗?

                  My goal is to have responsive images that also take up their appropriate space in the page layout upon its initial load. Does anyone know of a solution for this?

                  *编辑(解决方案) - 这是我找到的关于该主题的最佳文章.不错的方法!

                  推荐答案

                  这里的正确答案是使用padding-bottom技巧"来防止垂直回流.要使这项技术发挥作用,您必须事先知道图像的比例.

                  The correct answer here is to prevent the vertical reflow by using the "padding-bottom trick". To make this technique work, you must know the proportions of the image in advance.

                  感谢 Anders M. Anderson 就该主题发表了一篇出色的文章:http://andmag.se/2012/10/responsive-images-how-to-prevent-reflow/

                  Thanks to Anders M. Anderson for posting an excellent article on the topic: http://andmag.se/2012/10/responsive-images-how-to-prevent-reflow/

                  这篇关于在浏览器布局中为响应式图像保留空间(防止回流)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                  Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                  How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                  How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                  How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                  How to get number of video views with YouTube API?(如何使用 YouTube API 获取视频观看次数?)
                      <legend id='iVA1v'><style id='iVA1v'><dir id='iVA1v'><q id='iVA1v'></q></dir></style></legend>
                    1. <i id='iVA1v'><tr id='iVA1v'><dt id='iVA1v'><q id='iVA1v'><span id='iVA1v'><b id='iVA1v'><form id='iVA1v'><ins id='iVA1v'></ins><ul id='iVA1v'></ul><sub id='iVA1v'></sub></form><legend id='iVA1v'></legend><bdo id='iVA1v'><pre id='iVA1v'><center id='iVA1v'></center></pre></bdo></b><th id='iVA1v'></th></span></q></dt></tr></i><div id='iVA1v'><tfoot id='iVA1v'></tfoot><dl id='iVA1v'><fieldset id='iVA1v'></fieldset></dl></div>
                    2. <small id='iVA1v'></small><noframes id='iVA1v'>

                        <tfoot id='iVA1v'></tfoot>
                          <tbody id='iVA1v'></tbody>

                          <bdo id='iVA1v'></bdo><ul id='iVA1v'></ul>