示例工程 13-flex-basics
13-flex-basics/app/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
*,
*::before,
*::after {
box-sizing: border-box;
}
body,
h1,
h2,
h3,
p {
margin: 0;
}
body {
min-height: 100vh;
background: #f8fafc;
color: #0f172a;
font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
line-height: 1.7;
}
.site-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 16px 24px;
border-bottom: 1px solid #e2e8f0;
background: #ffffff;
}
.brand {
font-size: 13px;
font-weight: 700;
letter-spacing: 0.16em;
}
.top-nav {
display: flex;
gap: 16px;
}
.top-nav a {
color: #64748b;
font-size: 13px;
text-decoration: none;
}
.top-nav a:hover,
.top-nav a:focus-visible {
color: #2563eb;
}
.page {
width: min(100% - 40px, 860px);
margin: 0 auto;
padding: 40px 0 64px;
}
.eyebrow {
color: #64748b;
font-size: 11px;
letter-spacing: 0.18em;
}
h1 {
margin: 6px 0 10px;
font-size: clamp(30px, 5vw, 44px);
line-height: 1.12;
}
.lead {
color: #334155;
font-size: 16px;
}
.panel {
margin-top: 18px;
padding: 24px;
border: 1px solid #e2e8f0;
border-radius: 16px;
background: #ffffff;
}
h2 {
font-size: 19px;
}
h3 {
margin-top: 14px;
font-size: 13px;
color: #64748b;
}
.panel p {
margin-top: 8px;
color: #334155;
font-size: 14px;
}
.axis-demo {
position: relative;
margin-top: 14px;
padding: 34px 12px 12px;
border: 1px dashed #cbd5e1;
border-radius: 10px;
background: #f8fafc;
}
.axis-label {
position: absolute;
font-size: 10px;
font-family: ui-monospace, monospace;
color: #2563eb;
}
.axis-label.main { top: 8px; left: 12px; }
.axis-label.cross { top: 8px; right: 12px; color: #7c3aed; }
.flex-row,
.flex-column {
display: flex;
gap: 8px;
}
.flex-row span,
.flex-column span {
display: grid;
place-items: center;
width: 54px;
height: 40px;
border-radius: 6px;
background: #2563eb;
color: #ffffff;
font-size: 12px;
}
.flex-row.reverse {
flex-direction: row-reverse;
justify-content: flex-end;
}
.flex-column {
flex-direction: column;
}
.direction-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
}
.tag-row {
display: flex;
gap: 8px;
margin-top: 8px;
padding: 10px;
border: 1px dashed #cbd5e1;
border-radius: 8px;
background: #f8fafc;
}
.tag-row span {
flex: 0 0 auto;
padding: 4px 10px;
border-radius: 999px;
background: #eff6ff;
color: #1e40af;
font-size: 12px;
}
.tag-row.nowrap {
flex-wrap: nowrap;
overflow-x: auto;
}
.tag-row.wrap {
flex-wrap: wrap;
}
.toolbar {
display: flex;
align-items: center;
gap: 8px;
margin-top: 12px;
padding: 8px;
border: 1px solid #e2e8f0;
border-radius: 10px;
background: #f8fafc;
}
.toolbar button {
padding: 6px 12px;
border: 1px solid #cbd5e1;
border-radius: 6px;
background: #ffffff;
color: #0f172a;
font-size: 12px;
}
.toolbar .primary {
border-color: #2563eb;
background: #2563eb;
color: #ffffff;
}
.toolbar-spacer {
flex: 1;
}
.site-footer {
padding: 20px 24px 36px;
color: #64748b;
font-size: 12px;
text-align: center;
}
@media (max-width: 640px) {
.site-header {
align-items: flex-start;
flex-direction: column;
padding: 14px 18px;
}
.page {
width: min(100% - 28px, 860px);
padding: 28px 0 48px;
}
.panel {
padding: 18px;
}
.direction-grid {
grid-template-columns: 1fr;
}
}