示例工程 14-flex-alignment
14-flex-alignment/demo-02-align/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;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: 26px;
}
h2 {
margin: 18px 0 6px;
font-size: 13px;
color: #64748b;
}
.stage {
display: flex;
gap: 8px;
height: 110px;
padding: 8px;
border: 1px dashed #cbd5e1;
border-radius: 8px;
background: #ffffff;
}
.stage i {
display: grid;
place-items: center;
width: 46px;
border-radius: 6px;
background: #2563eb;
color: #ffffff;
font-size: 12px;
font-style: normal;
}
.stage i:nth-child(1) { height: 26px; }
.stage i:nth-child(2) { height: 48px; }
.stage i:nth-child(3) { height: 70px; }
.stretch { align-items: stretch; }
.stretch i { height: auto; }
.center { align-items: center; }
.baseline {
align-items: baseline;
height: 86px;
}
.baseline b {
color: #0f172a;
font-family: ui-monospace, monospace;
}
.small { font-size: 12px; }
.mid { font-size: 18px; }
.large { font-size: 28px; }