发布时间:2023-07-02 17:30
The Rules of Margin Collapsehttps://www.joshwcomeau.com/css/rules-of-margin-collapse/
Definition: Elements' top and bottom margins are sometimes collapsed into a single margin that is equal to the larger of the two margins.
- Rule1: Only vertical margins collapse
- Rule2: Only adjacent elements collapse
- Rule3: The Bigger Margin Wins
- Rule4: Nesting doesn't prevent collapsing
- Because the parent's margin can absorb/transfer child's margin
- Unless .... (Rule 4.1)
There is another elements in-between the parent and child element
The parent element have a
height
set.The parent element have padding or border along the relevant edge.
Rule5: Margins can collapse in the same direction
And many more ... (see links above)
** Margins of floating and absolutely positioned elements never collapse.
Example:
SpringCloud笔记一: 跨模块调用,服务注册发现(Eureka、Nacos)
MonoJSG:联合语义和几何代价函数的单目3D目标检测(CVPR2022)
Lab: File path traversal, traversal sequences blocked with absolute path bypass:文件路径检索,使用绝对路径绕过语句阻塞
【Python爬虫技巧】快速格式化请求头Request Headers
【历史上的今天】7 月 18 日:英特尔成立;万维网上传了第一张照片;eBay 分拆 PayPal