📜  防止子边距移动父 css 代码示例

📅  最后修改于: 2022-03-11 14:47:59.389000             🧑  作者: Mango

代码示例1
/* Prevent Child Margin from Moving Parent */
.parent {
  margin: -1px;
  padding: 1px;
}
/* Alternatively */
.parent {
    display: flow-root; /* no supported by IE 11 */
}
/*
Learn more: https://www.w3.org/TR/CSS2/box.html#collapsing-margins
*/