docs.rodeo

MDN Web Docs mirror

prefers-contrast

{{CSSRef}} 

The prefers-contrast CSS media feature is used to detect whether the user has requested the web content to be presented with a lower or higher contrast.

Syntax

User preferences

Various operating systems do support such preferences and user agents are likely to rely on the settings provided by the operating system.

Examples

This example has an annoying low contrast by default.

HTML

<div class="contrast">low contrast box</div>

CSS

.contrast {
  width: 100px;
  height: 100px;
  outline: 2px dashed black;
}

@media (prefers-contrast: more) {
  .contrast {
    outline: 2px solid black;
  }
}

Result

{{EmbedLiveSample("Examples")}} 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN