示例工程 55-design-system

55-design-system/demo-02-form/style.css

css · 1.1 KB

运行:表单字段

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

:root {
  --ink: #0f172a;
  --muted: #64748b;
  --border: #cbd5e1;
  --brand: #4f46e5;
  --danger: #b91c1c;
}

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

h1 { margin: 0 0 4px; font-size: 26px; }
p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

.field {
  display: grid;
  gap: 4px;
  max-width: 380px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
}

.field input,
.field select {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.field input:focus-visible,
.field select:focus-visible {
  outline: 3px solid #b45309;
  outline-offset: 2px;
}

.hint { margin: 0; color: var(--muted); font-size: 11px; }

.error {
  display: none;
  margin: 0;
  color: var(--danger);
  font-size: 11px;
}

.invalid input {
  border-color: var(--danger);
}

.invalid .error { display: block; }

.field input:disabled,
.field select:disabled {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed;
}