示例工程 08-box-model

08-box-model/demo-02-margin-collapse/style.css

css · 0.5 KB

运行:外边距折叠

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

body {
  margin: 0;
  padding: 32px;
  background: #f8fafc;
  color: #0f172a;
  font-family: system-ui, sans-serif;
  line-height: 1.7;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

h2 {
  margin: 18px 0 8px;
  font-size: 16px;
  color: #64748b;
}

p {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.collapse p:first-child {
  margin-bottom: 30px;
}

.collapse p:last-child {
  margin-top: 20px;
}

.flex {
  display: flex;
  flex-direction: column;
  gap: 16px;
}