示例工程 03-selectors-basics
03-selectors-basics/app/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
*,
*::before,
*::after {
box-sizing: border-box;
}
body,
h1,
h2,
h3,
p,
ul,
ol {
margin: 0;
}
body {
min-height: 100vh;
background:
radial-gradient(circle at 12% 8%, #dbeafe 0 15%, transparent 15.5%),
#f8fafc;
color: #0f172a;
font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
line-height: 1.75;
}
.site-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 16px 24px;
border-bottom: 1px solid #e2e8f0;
background: #ffffff;
}
.brand {
color: #0f172a;
font-size: 13px;
font-weight: 700;
letter-spacing: 0.16em;
text-decoration: none;
}
.site-header nav {
display: flex;
gap: 16px;
}
.site-header nav a {
color: #64748b;
font-size: 13px;
text-decoration: none;
}
.site-header nav a:hover,
.site-header nav a:focus-visible {
color: #2563eb;
}
.page {
width: min(100% - 40px, 860px);
margin: 0 auto;
padding: 40px 0 64px;
}
.hero {
padding: 28px;
border: 1px solid #e2e8f0;
border-radius: 18px;
background: #ffffff;
box-shadow: 0 16px 36px rgb(15 23 42 / 6%);
}
.eyebrow {
color: #64748b;
font-size: 11px;
letter-spacing: 0.18em;
}
h1 {
margin-top: 6px;
font-size: clamp(32px, 6vw, 46px);
line-height: 1.1;
letter-spacing: -0.03em;
}
.lead {
margin-top: 12px;
color: #334155;
font-size: 16px;
}
.hero-meta {
display: inline-block;
margin-top: 14px;
padding: 3px 10px;
border-radius: 999px;
background: #eff6ff;
color: #1e40af;
font-size: 12px;
}
.panel {
margin-top: 18px;
padding: 24px;
border: 1px solid #e2e8f0;
border-radius: 16px;
background: #ffffff;
}
h2 {
font-size: 20px;
}
.panel p {
margin-top: 8px;
color: #334155;
font-size: 14px;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 14px;
padding: 0;
list-style: none;
}
.tag {
padding: 3px 10px;
border: 1px solid #e2e8f0;
border-radius: 999px;
color: #64748b;
font-size: 12px;
}
.tag[data-state="active"] {
border-color: #2563eb;
background: #eff6ff;
color: #1e40af;
font-weight: 600;
}
.button {
display: inline-block;
margin-top: 16px;
padding: 9px 14px;
border-radius: 9px;
background: #0f172a;
color: #ffffff;
font-size: 13px;
text-decoration: none;
}
.button:hover {
background: #2563eb;
}
.button:focus-visible {
outline: 3px solid #93c5fd;
outline-offset: 3px;
}
.cards {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 10px;
margin-top: 14px;
}
.card {
padding: 12px;
border: 1px solid #e2e8f0;
border-radius: 10px;
background: #f8fafc;
}
.card[data-state="open"] {
border-color: #86efac;
background: #f0fdf4;
}
.card[data-featured="true"] {
border-width: 2px;
border-color: #2563eb;
}
.card h3 {
font-size: 13px;
}
.card p {
margin-top: 4px;
font-size: 12px;
}
.steps {
margin-top: 12px;
padding-left: 22px;
color: #334155;
font-size: 14px;
}
.steps li {
padding: 2px 0;
}
.steps li:last-child {
color: #2563eb;
font-weight: 600;
}
.note {
margin-top: 12px;
}
code {
padding: 1px 5px;
border-radius: 4px;
background: #f1f5f9;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.9em;
}
.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;
}
.site-header nav {
flex-wrap: wrap;
gap: 10px 14px;
}
.page {
width: min(100% - 28px, 860px);
padding: 28px 0 48px;
}
.hero,
.panel {
padding: 20px;
}
.cards {
grid-template-columns: 1fr;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}