[CSS] Containing Block
Identifying the containing block
The process for identifying the containing block depends entirely on the value of the element's position
property:
-
If the
position
property isstatic
,relative
, orsticky
, the containing block is formed by the edge of the content box of the nearest ancestor element that is either a block container (such as an inline-block, block, or list-item element) or establishes a formatting context (such as a table container, flex container, grid container, or the block container itself). -
If the
position
property isabsolute
, the containing block is formed by the edge of the padding box of the nearest ancestor element that has aposition
value other thanstatic
(fixed
,absolute
,relative
, orsticky
). -
If the
position
property isfixed
, the containing block is established by the viewport (in the case of continuous media) or the page area (in the case of paged media). -
If the
position
property isabsolute
orfixed
, the containing block may also be formed by the edge of the padding box of the nearest ancestor element that has any of the following:- A
filter
,backdrop-filter
,transform
, orperspective
value other thannone
. - A
contain
value oflayout
,paint
,strict
orcontent
(e.g.contain: paint;
). - A
container-type
value other thannormal
. - A
will-change
value containing a property for which a non-initial value would form a containing block (e.g.filter
ortransform
). - A
content-visibility
value ofauto
.
- A
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2022-12-01 [Typescript] 123. Hard - Intersection
2021-12-01 [AWS] Assign a public IP address to an EC2 instance after launched
2020-12-01 [Java Spring] Implementing Spring Security
2019-12-01 [Javascript] Sort by multi factors
2019-12-01 [Javascript] Keyword 'in' to check prop exists on Object
2015-12-01 [Javascript] Advanced Reduce: Common Mistakes