aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/_doublecolon_-ms-check/index.html
blob: 6ebbdb1ea4994dd4d066fb1bbbb70ac28358af2e (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
title: '::-ms-check'
slug: 'Web/CSS/::-ms-check'
translation_of: 'Archive/Web/CSS/::-ms-check'
---
<div>{{CSSRef}}</div>

<div>{{non-standard_header}}</div>

<div> </div>

<p><strong><code>::-ms-check这个css伪类是微软扩展的用以表达</code></strong> checkboxes 和 radio 的勾选状态,其中 checkboxes 和 radio分别通过 <a href="/en-US/docs/Web/HTML/Element/input/checkbox">&lt;input type="checkbox"&gt;</a> 和 <a href="/en-US/docs/Web/HTML/Element/input/radio">&lt;input type="radio"&gt;</a>创建</p>

<p>只有IE浏览器和微软Edge浏览器支持该伪类。</p>

<h2 id="Allowable_properties" name="Allowable_properties">属性支持性</h2>

<p>只有以下css属性可以在选择器里使用 <code>::-ms-check</code> 伪类. 其他属性会被自动忽略</p>

<ul>
 <li>{{cssxref("background-clip")}}</li>
 <li>{{cssxref("background-color")}}</li>
 <li>{{cssxref("background-image")}}</li>
 <li>{{cssxref("background-origin")}}</li>
 <li>{{cssxref("background-repeat")}}</li>
 <li>{{cssxref("background-size")}}</li>
 <li>{{cssxref("border-bottom-color")}}</li>
 <li>{{cssxref("border-bottom-left-radius")}}</li>
 <li>{{cssxref("border-bottom-right-radius")}}</li>
 <li>{{cssxref("border-bottom-style")}}</li>
 <li>{{cssxref("border-bottom-width")}}</li>
 <li>{{cssxref("border-left-color")}}</li>
 <li>{{cssxref("border-left-style")}}</li>
 <li>{{cssxref("border-left-width")}}</li>
 <li>{{cssxref("border-right-color")}}</li>
 <li>{{cssxref("border-right-style ")}}</li>
 <li>{{cssxref("border-right-width")}}</li>
 <li>{{cssxref("border-top-color")}}</li>
 <li>{{cssxref("border-top-left-radius")}}</li>
 <li>{{cssxref("border-top-right-radius ")}}</li>
 <li>{{cssxref("border-top-style")}}</li>
 <li>{{cssxref("border-top-width")}}</li>
 <li>{{cssxref("box-shadow")}}</li>
 <li>{{cssxref("box-sizing")}}</li>
 <li>{{cssxref("color")}}</li>
 <li>{{cssxref("cursor")}}</li>
 <li>{{cssxref("display")}} (values <code>block</code>, <code>inline-block</code>, <code>none</code>)</li>
 <li>{{cssxref("@font-face")}}</li>
 <li>{{cssxref("font-size")}}</li>
 <li>{{cssxref("font-style")}}</li>
 <li>{{cssxref("font-weight")}}</li>
 <li>{{cssxref("height")}}</li>
 <li>{{cssxref("margin-bottom")}}</li>
 <li>{{cssxref("margin-left")}}</li>
 <li>{{cssxref("margin-right")}}</li>
 <li>{{cssxref("margin-top")}}</li>
 <li><code>-ms-background-position-x</code></li>
 <li><code>-ms-background-position-y</code></li>
 <li>{{cssxref("-ms-high-contrast-adjust")}}</li>
 <li>{{cssxref("opacity")}}</li>
 <li>{{cssxref("outline-color")}}</li>
 <li>{{cssxref("outline-style")}}</li>
 <li>{{cssxref("outline-width")}}</li>
 <li>{{cssxref("padding-bottom")}}</li>
 <li>{{cssxref("padding-left")}}</li>
 <li>{{cssxref("padding-right")}}</li>
 <li>{{cssxref("padding-top")}}</li>
 <li>{{cssxref("transform")}}</li>
 <li>{{cssxref("transform-origin")}}</li>
 <li>{{cssxref("visibility")}}</li>
 <li>{{cssxref("width")}}</li>
</ul>

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

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

<h2 id="Example" name="Example">例子</h2>

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

<pre class="brush: html">&lt;form&gt;
  &lt;label for="redButton"&gt;Red&lt;/label&gt;
  &lt;input type="radio" id="redButton"&gt;&lt;br&gt;
  &lt;label for="greenCheckbox"&gt;Green&lt;/label&gt;
  &lt;input type="checkbox" id="greenCheckbox"&gt;
&lt;/form&gt;</pre>

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

<pre class="brush: css">input, label {
  display: inline;
}

input[type=radio]::-ms-check {
  border-color: red; /* This will make the border red when the button is checked. */
  color: red; /* This will make the circle red when the button is checked. */
}

input[type=checkbox]::-ms-check {
  border-color: green; /* This will make the box green when the button is checked. */
  color: green; /* This will make the checkmark green when the button is checked. */
}
</pre>

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

<p>可以尝试下面的例子, 左边的截屏显示当用户不在ie浏览器或Edge浏览器上运行时勾选上按钮时的情况</p>

<p>{{ EmbedLiveSample('Examples', '', '', 'https://mdn.mozillademos.org/files/15814/ie11-example.PNG', 'Web/CSS/::-ms-check') }}</p>

<h2 id="Specifications" name="Specifications">详述</h2>

<p></p>

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

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>10.0</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>iOS WebKit</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>