示例工程 22-mobile-first

22-mobile-first/demo-02-order/style.css

css · 1.3 KB

运行:min-width 的顺序

点击「运行示例」后,左侧显示源码、右侧显示运行结果;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: 0 0 6px;
  font-size: 13px;
  color: #64748b;
}

.pane {
  max-width: 620px;
  margin-top: 16px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
}

.boxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.box {
  display: grid;
  place-items: center;
  min-height: 72px;
  padding: 8px;
  border-radius: 6px;
  background: #94a3b8;
  color: #ffffff;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  text-align: center;
}

.correct .box {
  background: #94a3b8;
}

@media (min-width: 480px) {
  .correct .box { background: #2563eb; }
}

@media (min-width: 760px) {
  .correct .box { background: #7c3aed; }
}

/* 故意写反顺序 */
@media (min-width: 760px) {
  .wrong .box { background: #7c3aed; }
}

@media (min-width: 480px) {
  .wrong .box { background: #2563eb; }
}

pre {
  max-width: 620px;
  margin-top: 18px;
  padding: 12px;
  overflow-x: auto;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 11px;
}

code {
  font-family: ui-monospace, monospace;
}