最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Does the browser's render reflow if element's position is absolute? - Stack Overflow

programmeradmin3浏览0评论

If I have an element with an absolute position and I change its left and top position will reflow to its parent children? And what about its 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 its children?

If I have an element with an absolute position and I change its left and top position will reflow to its parent children? And what about its 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 its children?

Share Improve this question edited May 12, 2022 at 3:14 polkovnikov.ph 6,6326 gold badges47 silver badges82 bronze badges asked Sep 7, 2011 at 18:09 Totty.jsTotty.js 15.8k31 gold badges109 silver badges179 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 22

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 its child objects to move along with it. It will not reflow them, they will just move along with their parent container.

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.

发布评论

评论列表(0)

  1. 暂无评论