files/en-us/web/css/reference/at-rules/@media/prefers-contrast/index.md
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.
no-preference
more
less
custom
more nor less. This value will match the color palette specified by users of forced-colors: active.Various operating systems do support such preferences and user agents are likely to rely on the settings provided by the operating system.
This example includes a box with a dashed {{cssxref("outline")}} set on it by default. When the prefers-contrast: more media query matches, the applied outline is given a higher contrast solid style instead.
<div class="contrast">low contrast box</div>
.contrast {
margin: 5px;
width: 100px;
height: 100px;
outline: 2px dashed black;
}
@media (prefers-contrast: more) {
.contrast {
outline: 2px solid black;
}
}
{{EmbedLiveSample("Examples")}}
{{Specifications}}
{{Compat}}