html属性没有位置,当绝对定位没有具有定位属性的父元素时,是相对浏览器窗口还是body或者html定位的?...

首先MDN上原话:

绝对定位元素相对于最近的非 static 祖先元素定位。当这样的祖先元素不存在时,则相对于ICB(inital container block, 初始包含块)。

而根元素所在的包含块就叫初始包含块(ICB),所以也就是说当绝对定位的元素没有非 static定位属性的父元素时,相对于ICB定位。

根元素的包含块一般是视口(连续媒体)或者由页面区域(paged media)

CSS2规范对于包含块的定义中说到:

The containing block in which the root element lives is a rectangle called the initial containing block. For continuous media, it has the dimensions of the viewport and is anchored at the canvas origin; it is the page area for paged media. The 'direction' property of the initial containing block is the same as for the root element.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值