Skip to content
Go back

CSS Position Fixed 定位机制详解

Edit page

Table of contents

Open Table of contents

前言

position:fixed 前面一直以为是浏览器窗口进行定位; 最近工作中出现一个 bug,将弹框组件(弹框是 fixed 定位)写下 tabcont 中,页面显示弹框是相对于 tabcont 进行定位。 这个 bug 出现直接颠覆自己认知;

重新认识一下

MDN Web Docs

取值

可以看到。fixed 中有这么一段话:

当元素祖先的 transform, perspective 或 filter 属性非 none 时,容器由视口改为该祖先


Edit page
Share this post on:

Previous Post
Docker 入门与常用命令
Next Post
华为手机全量包刷机教程与系统优化指南