--- title: '-webkit-device-pixel-ratio' slug: Web/CSS/@media/-webkit-device-pixel-ratio translation_of: Web/CSS/@media/-webkit-device-pixel-ratio ---
{{ Non-standard_header() }}
-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 {{cssxref("<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 |
---|---|---|
{{SpecName('Compat', '#css-media-queries-webkit-device-pixel-ratio', '-webkit-device-pixel-ratio')}} | {{Spec2('Compat')}} | Initial standardization |
Safari CSS Reference 'media query extensions' in that document. |
Non-standard unofficial documentation | Initial documentation |