cuốn sách gpt4 ai đã làm

html - 位置 : absolute;

In lại Tác giả: Walker 123 更新时间:2023-11-28 14:27:22 27 4
mua khóa gpt4 Nike

/codepen 链接曾经在这里/

当我没有给我的主页脚指定位置时,段落元素与根元素无关。为什么它与我的 .banner 元素有关?这不是它的祖先。这是一个错误吗?

.main-footer {
/*position: relative;
}*/

.main-footer p {
vị trí: tuyệt đối;
bottom: 1px;
}

"Elements that are relatively positioned remain in the normal flow of the document. In contrast, an element that is absolutely positioned is taken out of the flow; thus, other elements are positioned as if it did not exist. The absolutely positioned element is positioned relative to its nearest positioned ancestor (i.e., the nearest ancestor that is not static). If a positioned ancestor doesn't exist, it is positioned relative to the ICB (initial containing block), which the containing block of the document's root element." - https://developer.mozilla.org/en-US/docs/Web/CSS/position

câu trả lời hay nhất

在你的 codepen 中,移除 .main-footer 上的定位后,.main-footer p 是相对于 thân hình 的是最近的根祖先。它可能看起来与 .banner 相关,因为它们在同一个地方结束,但如果您完全删除多余的元素,您可以非常清楚地看到它。

https://codepen.io/anon/pen/WPOjOZ

在 Chrome 中测试

关于html - 位置 : absolute;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54509563/

27 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress