-moz-device-pixel-ratio
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Tính năng phương tiện -moz-device-pixel-ratio CSS dành riêng cho Gecko media feature có thể được dùng để áp dụng các kiểu dáng dựa trên số pixel thiết bị trên mỗi pixel CSS.
Warning:
Không sử dụng tính năng này. Thay vào đó hãy sử dụng tính năng resolution với đơn vị dppx.
Note:
Tính năng phương tiện này cũng được WebKit triển khai là -webkit-device-pixel-ratio. Các tiền tố min và max như được Gecko triển khai có tên là min--moz-device-pixel-ratio và max--moz-device-pixel-ratio; nhưng các tiền tố tương tự như WebKit triển khai có tên là -webkit-min-device-pixel-ratio và -webkit-max-device-pixel-ratio.
Cú pháp
<number>-
Số pixel thiết bị trên mỗi pixel CSS.
Phương tiện: @media
Chấp nhận tiền tố min/max: có
Ví dụ
>Ví dụ tương thích cơ bản
-moz-device-pixel-ratio có thể được dùng để tương thích với Firefox phiên bản cũ hơn 16, và cùng với -webkit-device-pixel-ratio để tương thích với các trình duyệt dựa trên WebKit không hỗ trợ dppx.
Ví dụ:
/* First, set for WebKit-based browsers */
@media (-webkit-min-device-pixel-ratio: 2),
(min--moz-device-pixel-ratio: 2) /* Older Firefox browsers (prior to firefox 16) */,
(min-resolution: 2dppx) /* The standard way */,
(min-resolution: 192dpi); /* dppx fallback */
Note:
Xem bài viết CSSWG này để biết các thực hành tốt về tương thích liên quan đến resolution và dppx.
Thông số kỹ thuật
Không phải là một phần của bất kỳ tiêu chuẩn nào.