Quiz HTML & CSS: Custom Properties (CSS Variables)

This CSS quiz is about custom properties: declaring --name values, reading them with var(), and how they inherit and cascade. It also covers fallbacks, calc(), changing variables from JavaScript and registering them with @property.

Trung bình 10 câu hỏi ~6 phút Đạt từ 80%

Chọn chế độ

Bạn đang chơi với tư cách khách: đăng nhập để lưu XP và streak.

Câu hỏi mẫu

Câu 1/10

Which code declares a custom property and uses it correctly?

Xem đáp án

D. :root { --brand: #06c; } a { color: var(--brand); } Custom property names start with two dashes and are read with var(--name). The $ and @ forms belong to Sass and Less, not to plain CSS.

Quiz này có gì

  • Declaring --name and reading it with var()
  • Fallback values and nested fallbacks
  • Scope, inheritance and case sensitivity
  • Invalid at computed-value time, and why variables do not work in media queries
  • calc() with variables, JavaScript setProperty() and @property

Câu hỏi thường gặp

Có cần tài khoản không?

Không. Ai cũng chơi được. Đăng nhập để lưu XP, streak, badge và lịch sử.

Có làm lại được không?

Được. Điểm cao nhất của bạn được giữ lại, câu hỏi và đáp án được xáo trộn mỗi lần.