Перейти до основного вмісту
← 🎨 CSS as a design system·Модуль B8 · Урок 12
ЗавданняBuild a Button + Card design system. @layer tokens, base, components. tokens: :root --primary, --bg, --text, --border, --radius. base: :where(body) font-family system-ui sans-serif, padding 24px. base: :where(button) cursor pointer. components: .button with custom-prop API (--bg, --fg, --pad-x, --pad-y) + variants (.primary, .danger). components: .card via @scope with h3 + p + button styling. .card:has(.featured-badge) gets a gold border.

Модуль capstone: примітив системи дизайну (кнопка + картка)

200 XP14 min
Теорія

Putting B8 together

Build a 2-component design system that uses EVERY B8 concept:

  • B8-01: @layer with explicit priority.
  • B8-02: CSS nesting for component definitions.
  • B8-03: :has() for parent-style-based-on-child.
  • B8-04: :where() for zero-specificity reset.
  • B8-05: Custom properties as component API (--bg, --pad).
  • B8-06: @scope for component-local rules.
  • B8-10: 3-layer structure (tokens, base, components).

End: a Button + Card system where variants are CSS-var overrides, scoping is via @scope, and the cascade is layered.

🔒

Зареєструйся щоб кодувати

Теорія відкрита всім. Інтерактивний редактор, живий перегляд і перевірка відкриваються з 7-денним безкоштовним trial — потрібна картка, скасування у будь-який час.

Реєстрація — безкоштовний trial →

Перші 10 уроків у кожному треку — безкоштовні. Картка не потрібна.

← НазадНаступний урок →

Отримуй одну пораду з Python чи вебу — щодня поштою

Коротко, без води, без спаму. Відписка — в один клік.