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

css - 了解位置 :absolute

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

以下来自cái này问题的最佳答案

Absolute CSS Positioning

vị trí: tuyệt đối;

This tells the browser that whatever is going to be positioned should be removed from the normal flow of the document and will be placed in an exact location on the page. It won't affect how the elements before it or after it in the HTML are positioned on the Web page however it will be subject to it's parents' positioning unless you override it.

现在看下面的代码:


Panel with panel-primary class












如果我做:span{ position: absolute;}结果如下:

nhập mô tả hình ảnh ở đây

查看箭头的位置,它们相对于 div.panel-heading 或 div.panel-primary 而不是相对于 div.panel-body(恰好是其直接父级)定位 .我不明白为什么?

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

引用w3.org CSS2 spec section 9.8.4 :

The containing block for a positioned box is established by the nearest positioned ancestor

“最近定位的祖先”是任何非静态的父元素(chức vụ 的默认值)

biên tập:

Further reading on MDN , MDN 是理解 CSS 规范的绝佳资源,它们使用比官方规范更通俗易懂的语言。

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

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