Files
ClassContent/历届学生/罗朝/2019-04-03/笔记.txt
2024-09-27 02:06:13 +08:00

36 lines
830 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

position
relative 相对定位
相当原本初始位置进行移动,原本位置还在文档流中
absolute 绝对定位
当一个元素被设置绝对定位后,原本位置将会从文档流中被删除,其他元素占据他的原本位置。
参考对象:
1如果 被设置绝对定位 的元素有父级元素,且父元素已经定位,那么参考父元素进行定位
2如果 被设置绝对定位 的元素有父级元素,且父元素没有定位,那么参考浏览器边框
父元素已经定位:
relative, absolute, fixed
fixed 固定定位
参考对象:浏览器边框
盒子模型
padding 内边距
border 边框
margin 外边距
content 内容
计算规则:
元素的真实宽高 = content + (padding + padding) + (border + border)