-webkit-device-pixel-ratio

非标准: 该特性是非标准的,请尽量不要在生产环境中使用它!

-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.

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.

css
@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
Compatibility Standard
# css-media-queries-webkit-device-pixel-ratio

See also