Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于绝对定位的参考点 #281

Open
kumufeng opened this issue Mar 17, 2024 · 0 comments
Open

关于绝对定位的参考点 #281

kumufeng opened this issue Mar 17, 2024 · 0 comments

Comments

@kumufeng
Copy link

首先声明,作者写的很好,我是看了 2024年Web前端开发流程和学习路线(详尽版) (推荐)后过来的,看这个教程温故知新

关于绝对定位的参考点,文中的说法是:一个绝对定位的元素,如果父辈元素中也出现了已定位(无论是绝对定位、相对定位,还是固定定位)的元素,那么将以父辈这个元素,为参考点。

更准确的说法应该是:绝对定位元素相对于最近的非 static 祖先元素定位。当这样的祖先元素不存在时,则相对于 ICB(initial containing block,初始包含块)。
测试截图如下:
image

附:关于包含块的概念

@kumufeng kumufeng changed the title 关于绝对定位的参考点与z-index 关于绝对定位的参考点 Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant