-webkit-device-pixel-ratio 是一个非标准的布尔类型CSS媒体类型,是标准 resolution 媒体类型的一个替代方案.

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.


-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) { ... }


Specification Status Comment
Compatibility Standard
Living Standard Initial standardization
Safari CSS Reference
'media query extensions' in that document.
Non-standard unofficial documentation Initial documentation

See also