From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/resolution/index.html | 98 +++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 files/zh-cn/web/css/resolution/index.html (limited to 'files/zh-cn/web/css/resolution') diff --git a/files/zh-cn/web/css/resolution/index.html b/files/zh-cn/web/css/resolution/index.html new file mode 100644 index 0000000000..c388088a35 --- /dev/null +++ b/files/zh-cn/web/css/resolution/index.html @@ -0,0 +1,98 @@ +--- +title: +slug: Web/CSS/resolution +tags: + - CSS + - 参考系 + - 布局 +translation_of: Web/CSS/resolution +--- +
{{CSSRef}}
+ +
分辨率:用于描述媒体查询中的分辨率的<resolution> CSS数据类型表示输出设备的像素密度。
+ +

在屏幕上,单位与CSS英寸,厘米或像素有关,而与物理值无关。

+ +

Syntax

+ +

<resolution>数据类型由严格为正{{cssxref("<number>")}}组成,后跟下面列出的单位之一。与所有CSS维度一样,单位字面值与数字之间没有空格。

+ +

单位

+ +
+
dpi
+
表示每英寸的点数。屏幕通常每英寸包含72或96个点,但打印文档的dpi通常要大得多。 1英寸是2.54厘米,1dpi≈0.39dpcm。
+
dpcm
+
每厘米上的点数。1英寸是2.54厘米, 1dpcm ≈ 2.54dpi.
+
dppx
+
表示每个px的点数。 由于CSS px的固定比率为1:96,因此1dppx相当于96dpi。 which corresponds to the default resolution of images displayed in CSS as defined by {{cssxref("image-resolution")}}.
+
x
+
 dppx 的别名
+
+ +
+

Note: Although the number 0 is always the same regardless of unit, the unit may not be omitted. In other words, 0 is invalid and does not represent 0dpi, 0dpcm, or 0dppx.

+
+ +

Examples

+ +

Use in a media query

+ +
@media print and (min-resolution: 300dpi) { ... }
+ +

Valid resolutions

+ +
96dpi
+50.82dpcm
+3dppx
+
+ +

Invalid resolutions

+ +
72 dpi     Spaces are not allowed between the number and the unit.
+ten dpi    The number must use digits only.
+0          The unit is required.
+
+ +

Specifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('CSS4 Values', '#resolution', '<resolution>')}}{{Spec2('CSS4 Values')}}Adds the x unit.
{{SpecName('CSS3 Values', '#resolution', '<resolution>')}}{{Spec2('CSS3 Values')}}Adds the dppx unit.
{{SpecName('CSS3 Media Queries', '#resolution', '<resolution>')}}{{Spec2('CSS3 Media Queries')}}Initial definition.
+ +

Browser compatibility

+ +
+ + +

{{Compat("css.types.resolution")}}

+
+ +

See also

+ + -- cgit v1.2.3-54-g00ecf