<分区>
在 HTML 中,当您在子 block 中使用 position:absolute css 属性时,绝对值不是从父标记中获取的,而是从整个浏览器窗口引用的。 示例代码如下所示。
CSS
.parent {
width: 400px;
height: 400px;
border: 1px solid green;
}
.child {
position: absolute;
width: 200px;
height: 200px;
border: 1px solid red;
bottom: 0px;
}