-webkit-device-pixel-ratio

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

-webkit-device-pixel-ratio is a non-standard boolean CSS media feature which is an alternative to the standard resolution media feature.

Its value is the number of device pixels used to represent each CSS px. Although the value is a <number> and thus doesn't syntactically allow units, its implicit unit is dppx.

Syntax

-webkit-device-pixel-ratio is a range value meaning the prefixed -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio are also available.

@media (-webkit-min-device-pixel-ratio: 2) { ... }
/* is equivalent to */
@media (min-resolution: 2dppx) { ... }
/* And likewise */
@media (-webkit-max-device-pixel-ratio: 2) { ... }
/* is equivalent to */
@media (max-resolution: 2dppx) { ... }

Specifications

Specification Status Comment
Web Compatibility Standard
The definition of '-webkit-device-pixel-ratio' in that specification.
Living Standard Initial standardization
Safari CSS Reference
'media query extensions' in that document.
Non-standard unofficial documentation Initial documentation

See also

Document Tags and Contributors

 Contributors to this page: Sebastianz, rolfedh, cvrebert
 Last updated by: Sebastianz,