Does the browser's render reflow if element's position is absolute?

好久不见. 提交于 2019-12-21 12:21:31

问题


If I have an element with an absolute position and I change it's left and top position will reflow to it's parent children? and what about it's own children if they are not affected as they are also absolute positioned by left and top axis?

If I change an element's width/height but have no importance in the parent and in it's children?


回答1:


An object with absolute position does not affect the layout of the page. The page is laid out without regard for an absolute positioned object. Moving the absolute positioned object does not cause any reflow of other objects.

Moving an object with absolute positioning will cause it's child objects to move along with it. It will not reflow them, they will just move along with their parent container.




回答2:


For element with absolute position, it should not affect document flow, and so it's position change should not lead to reflow(relayout) of the page's dom tree, but if you test this simple case with Chrome DevTools, we can see it really causes relayout(the whole document) though in very short time. Probably the render engine didn't deal with it as a special case.



来源:https://stackoverflow.com/questions/7338514/does-the-browsers-render-reflow-if-elements-position-is-absolute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!