monochrome

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Das monochrome CSS Media-Feature kann verwendet werden, um die Anzahl der Bits pro Pixel im monochromen Framebuffer des Ausgabegeräts zu testen.

Syntax

Das monochrome-Feature wird als ein <integer> angegeben, der die Anzahl der Bits pro Pixel im monochromen Framebuffer darstellt. Wenn das Gerät kein monochromes Gerät ist, beträgt der Wert null. Es handelt sich um ein Bereichsfeature, was bedeutet, dass Sie auch die präfixierten Varianten min-monochrome und max-monochrome verwenden können, um minimale bzw. maximale Werte abzufragen.

Beispiele

HTML

html
<p class="mono">Your device supports monochrome pixels!</p>
<p class="no-mono">Your device doesn't support monochrome pixels.</p>

CSS

css
p {
  display: none;
}

/* Any monochrome device */
@media (monochrome) {
  p.mono {
    display: block;
    color: #333;
  }
}

/* Any non-monochrome device */
@media (monochrome: 0) {
  p.no-mono {
    display: block;
    color: #ee3636;
  }
}

Ergebnis

Spezifikationen

Specification
Media Queries Level 4
# monochrome

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
monochrome media feature

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support