blob: c388088a35e18f61dc1a0d0cc5115618db907f78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
---
title: <resolution>
slug: Web/CSS/resolution
tags:
- CSS
- 参考系
- 布局
translation_of: Web/CSS/resolution
---
<div>{{CSSRef}}</div>
<div>分辨率:用于描述<a href="/en-US/docs/Web/CSS/Media_Queries">媒体查询</a>中的分辨率的<resolution> CSS<a href="/en-US/docs/Web/CSS/CSS_Types">数据类型</a>表示输出设备的像素密度。</div>
<p>在屏幕上,单位与CSS英寸,厘米或像素有关,而与物理值无关。</p>
<h2 id="Syntax">Syntax</h2>
<p><resolution>数据类型由严格为正{{cssxref("<number>")}}组成,后跟下面列出的单位之一。与所有CSS维度一样,单位字面值与数字之间没有空格。</p>
<h3 id="单位">单位</h3>
<dl>
<dt><a id="dpi" name="dpi"><code id="dpi">dpi</code></a></dt>
<dd>表示<a href="https://en.wikipedia.org/wiki/Dots_per_inch">每英寸的点数</a>。屏幕通常每英寸包含72或96个点,但打印文档的dpi通常要大得多。 1英寸是2.54厘米,1dpi≈0.39dpcm。</dd>
<dt><a id="dpcm" name="dpcm"><code id="dpcm">dpcm</code></a></dt>
<dd><a href="https://en.wikipedia.org/wiki/Dots_per_inch">每厘米上的点数</a>。1英寸是2.54厘米, <code>1dpcm ≈ 2.54dpi</code>.</dd>
<dt><a id="dppx" name="dppx"><code id="dppx">dppx</code></a></dt>
<dd>表示每个<code><a href="/en-US/docs/Web/CSS/length#px">px</a></code>的点数。 由于CSS px的固定比率为1:96,因此1dppx相当于96dpi。 which corresponds to the default resolution of images displayed in CSS as defined by {{cssxref("image-resolution")}}.</dd>
<dt><a id="x" name="x"><code>x</code></a></dt>
<dd> <code>dppx</code> 的别名</dd>
</dl>
<div class="note">
<p><strong>Note:</strong> Although the number <code>0</code> is always the same regardless of unit, the unit may not be omitted. In other words, <code>0</code> is invalid and does not represent <code>0dpi</code>, <code>0dpcm</code>, or <code>0dppx</code>.</p>
</div>
<h2 id="Examples">Examples</h2>
<h3 id="Use_in_a_media_query">Use in a media query</h3>
<pre class="brush: css">@media print and (min-resolution: 300dpi) { ... }</pre>
<h3 id="Valid_resolutions">Valid resolutions</h3>
<pre>96dpi
50.82dpcm
3dppx
</pre>
<h3 id="Invalid_resolutions">Invalid resolutions</h3>
<pre class="example-bad">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.
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSS4 Values', '#resolution', '<resolution>')}}</td>
<td>{{Spec2('CSS4 Values')}}</td>
<td>Adds the <code>x</code> unit.</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Values', '#resolution', '<resolution>')}}</td>
<td>{{Spec2('CSS3 Values')}}</td>
<td>Adds the <code>dppx</code> unit.</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Media Queries', '#resolution', '<resolution>')}}</td>
<td>{{Spec2('CSS3 Media Queries')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
<p>{{Compat("css.types.resolution")}}</p>
</div>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/Web/CSS/@media/resolution">resolution</a> media feature</li>
</ul>
|