aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/_colon_-moz-only-whitespace/index.html
blob: 608db408478379f07a22bfbc4ef1cbaf9eeaa47a (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
---
title: ':blank'
slug: 'Web/CSS/:-moz-only-whitespace'
translation_of: 'Web/CSS/:-moz-only-whitespace'
---
<div>{{CSSRef}}{{SeeCompatTable}}</div>

<p><strong><code>:blank</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> <a href="/zh-CN/docs/Web/CSS/Pseudo-classes">伪类选择器</a> 用于匹配如下节点</p>

<p>1. 没有子节点;</p>

<p>2. 仅有空的文本节点;</p>

<p>3. 仅有空白符的文本节点.</p>

<h2 id="语法">语法</h2>

<pre class="syntaxbox">{{CSSSyntax}}</pre>

<h2 id="样例">样例</h2>

<h3 id="HTML">HTML</h3>

<pre class="brush: html;">&lt;div&gt; &lt;/div&gt;
</pre>

<h3 id="CSS">CSS</h3>

<div class="hidden">
<pre class="brush: css;">:root {
  overflow: hidden;
  max-width: 100vw;
  max-height: 100vh;
}

div {
  background-color: #ccc;
  box-sizing: border-box;
  height: 100vh;
  min-height: 16px;
  min-height: 1rem;
}

:-moz-only-whitespace {
  border-color: lime;
}</pre>
</div>

<pre class="brush: css;">div {
  border: 4px solid red;
}

:blank {
  border-color: lime;
}</pre>

<h3 id="结果">结果</h3>

<p>{{EmbedLiveSample("Example", "100%", "50")}}</p>

<h2 id="规范">规范</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 Selectors", "#blank-pseudo", ":blank")}}</td>
   <td>{{Spec2("CSS4 Selectors")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("css.selectors.blank")}}</p>

<h2 id="参考">参考</h2>

<ul>
 <li>{{CSSxRef(":empty")}}</li>
</ul>