CSS CSS Quality & Compliance 3 — Questions and Answers
Question 1: What does the 'prefers-reduced-motion' media query allow developers to do?
- Respect users who want fewer animations (Correct answer)
- Force dark mode
- Disable all CSS
- Increase font size automatically
Correct answer: Respect users who want fewer animations
prefers-reduced-motion lets you reduce or remove animation for users sensitive to motion.
Question 2: Which approach best prevents CSS specificity conflicts in a component-based design?
- Scoping styles with low-specificity, modular class names (Correct answer)
- Using only element selectors globally
- Relying on inline styles everywhere
- Adding !important to every rule
Correct answer: Scoping styles with low-specificity, modular class names
Modular, low-specificity class names keep components isolated and conflict-free.
Question 3: Why should color alone not be used to convey information?
- Color-blind users may not perceive the distinction (Correct answer)
- It increases file size
- It slows rendering
- Browsers ignore color
Correct answer: Color-blind users may not perceive the distinction
WCAG requires information be conveyed by more than color so color-blind users aren't excluded.
Question 4: What is the benefit of a CSS reset or normalize stylesheet?
- Reducing inconsistent default styling across browsers (Correct answer)
- Removing the need for HTML
- Disabling JavaScript
- Eliminating media queries
Correct answer: Reducing inconsistent default styling across browsers
Resets and normalize stylesheets create a consistent baseline across different browsers.
Question 5: Which unit is recommended for font sizes to respect user accessibility settings?
- rem (Correct answer)
- px
- vmax
- pt
Correct answer: rem
rem scales with the root font size, honoring a user's browser text-size preferences.
Question 6: What does a CSS code review most commonly check for?
- Unused rules, duplication, and naming consistency (Correct answer)
- Server uptime
- Database indexes
- API rate limits
Correct answer: Unused rules, duplication, and naming consistency
CSS reviews focus on dead code, duplication, and adherence to naming conventions.
Question 7: Which compliance standard governs web accessibility most widely referenced for CSS?
- WCAG (Correct answer)
- GDPR
- PCI-DSS
- ISO 9001
Correct answer: WCAG
The Web Content Accessibility Guidelines (WCAG) define accessibility requirements for web content.
What does the 'prefers-reduced-motion' media query allow developers to do?