How can CSS be used to create high contrast modes for accessibility?
Instruction: Discuss methods to implement high contrast modes using CSS to enhance accessibility.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Start with readable default colors and visible controls. prefers-contrast: more detects a preference for greater contrast; high is not a valid value. This is distinct from forced-colors: active, where the browser substitutes a user-selected limited palette.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS example</title> <style> :root { --surface: #fff; --ink: #222; } body { background: var(--surface); color: var(--ink); } button { color: inherit;...