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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
---
title: cursor
slug: Web/CSS/cursor
translation_of: Web/CSS/cursor
---
<div>{{CSSRef}}</div>
<p>此 <strong><code>cursor</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> 屬性可以指定當滑鼠指標指向哪個物件時,顯示不同的游標.</p>
<div>{{EmbedInteractiveExample("pages/css/cursor.html")}}</div>
<h2 id="語法">語法</h2>
<pre class="brush: css no-line-numbers">/* 關鍵字值 */
cursor: pointer;
cursor: auto;
/* URL, with a keyword fallback */
cursor: url(hand.cur), pointer;
/* URL and coordinates, with a keyword fallback */
cursor: url(cursor1.png) 4 12, auto;
cursor: url(cursor2.png) 2 2, pointer;
/* 全域值 */
cursor: inherit;
cursor: initial;
cursor: unset;
</pre>
<p>The <code>cursor</code> property is specified as zero or more <code><a href="#<url>"><url></a></code> values, separated by commas, followed by a single mandatory <a href="#Keyword values">keyword value</a>. Each <code><url></code> should point to an image file. The browser will try to load the first image specified, falling back to the next if it can't, and falling back to the keyword value if no images could be loaded (or if none were specified).</p>
<p>Each <code><url></code> may be optionally followed by a pair of space-separated numbers, which represent <code><a href="#<x> <y>"><x><y></a></code> coordinates. These will set the cursor's hotspot, relative to the top-left corner of the image.</p>
<p>For example, this specifies two images using <code><url></code> values, providing <code><x><y></code> coordinates for the second one, and falling back to the <code>progress</code> keyword value if neither image can be loaded:</p>
<pre class="brush: css">cursor: url(one.svg), url(two.svg) 5 5, progress;</pre>
<h3 id="數值">數值</h3>
<dl>
<dt><code id="<url>"><url></code></dt>
<dd>A <code>url(…)</code> or a comma separated list <code>url(…), url(…), …</code>, pointing to an image file. More than one {{cssxref("<url>")}} may be provided as fallbacks, in case some cursor image types are not supported. A non-URL fallback (one or more of the keyword values) <em>must</em> be at the end of the fallback list. See <a href="/en-US/docs/CSS/Using_URL_values_for_the_cursor_property" title="Using_URL_values_for_the_cursor_property">Using URL values for the cursor property</a> for more details.</dd>
<dt><a name="<x> <y>"><code><x></code> <code><y></code> </a>{{experimental_inline}}</dt>
<dd>Optional x- and y-coordinates. Two unitless nonnegative numbers less than 32.</dd>
<dt>關鍵字值</dt>
<dd>
<p><em>Move your mouse over values to see their live appearance in your browser:</em></p>
<table class="standard-table">
<thead>
<tr>
<th scope="col">分類</th>
<th scope="col">CSS 值</th>
<th scope="col">範例</th>
<th scope="col">備註說明</th>
</tr>
</thead>
<tbody>
<tr style="cursor: auto;">
<th rowspan="3" scope="row">一般</th>
<td><code>auto</code></td>
<td> </td>
<td>The UA will determine the cursor to display based on the current context. E.g., equivalent to <code>text</code> when hovering text.</td>
</tr>
<tr style="cursor: default;">
<td><code>default</code></td>
<td><img alt="default.gif" src="/@api/deki/files/3438/=default.gif" style="height: 26px; width: 26px;"></td>
<td>The platform-dependent default cursor. Typically an arrow.</td>
</tr>
<tr style="cursor: none;">
<td><code>none</code></td>
<td> </td>
<td>No cursor is rendered.</td>
</tr>
<tr style="cursor: context-menu;">
<th rowspan="5" scope="row" style="cursor: auto;">連結與狀態</th>
<td><code>context-menu</code></td>
<td><img alt="context-menu.png" src="/@api/deki/files/3461/=context-menu.png" style="height: 26px; width: 26px;"></td>
<td>A context menu is available.</td>
</tr>
<tr style="cursor: help;">
<td><code>help</code></td>
<td><img alt="help.gif" src="/@api/deki/files/3442/=help.gif" style="height: 26px; width: 26px;"></td>
<td>Help information is available.</td>
</tr>
<tr style="cursor: pointer;">
<td><code>pointer</code></td>
<td><img alt="pointer.gif" src="/@api/deki/files/3449/=pointer.gif" style="height: 26px; width: 26px;"></td>
<td>The cursor is a pointer that indicates a link. Typically an image of a pointing hand.</td>
</tr>
<tr style="cursor: progress;">
<td><code>progress</code></td>
<td><img alt="progress.gif" src="/@api/deki/files/3450/=progress.gif" style="height: 26px; width: 26px;"></td>
<td>The program is busy in the background, but the user can still interact with the interface (in contrast to <code>wait</code>).</td>
</tr>
<tr style="cursor: wait;">
<td><code>wait</code></td>
<td><img alt="wait.gif" src="/@api/deki/files/3457/=wait.gif" style="height: 26px; width: 26px;"></td>
<td>The program is busy, and the user can't interact with the interface (in contrast to <code>progress</code>). Sometimes an image of an hourglass or a watch.</td>
</tr>
<tr style="cursor: cell;">
<th rowspan="4" scope="row" style="cursor: auto;">選取</th>
<td><code>cell</code></td>
<td><img alt="cell.gif" src="/@api/deki/files/3434/=cell.gif" style="height: 26px; width: 26px;"></td>
<td>The table cell or set of cells can be selected.</td>
</tr>
<tr style="cursor: crosshair;">
<td><code>crosshair</code></td>
<td><img alt="crosshair.gif" src="/@api/deki/files/3437/=crosshair.gif" style="height: 26px; width: 26px;"></td>
<td>Cross cursor, often used to indicate selection in a bitmap.</td>
</tr>
<tr style="cursor: text;">
<td><code>text</code></td>
<td><img alt="text.gif" class="default" src="/files/3809/text.gif" style="height: 26px; width: 26px;"></td>
<td>The text can be selected. Typically the shape of an I-beam.</td>
</tr>
<tr style="cursor: vertical-text;">
<td><code>vertical-text</code></td>
<td><img alt="vertical-text.gif" src="/@api/deki/files/3456/=vertical-text.gif" style="height: 26px; width: 26px;"></td>
<td>The vertical text can be selected. Typically the shape of a sideways I-beam.</td>
</tr>
<tr style="cursor: alias;">
<th rowspan="7" scope="row" style="cursor: auto;">拖曳</th>
<td><code>alias</code></td>
<td><img alt="alias.gif" src="/@api/deki/files/3432/=alias.gif" style="height: 26px; width: 26px;"></td>
<td>An alias or shortcut is to be created.</td>
</tr>
<tr style="cursor: copy;">
<td><code>copy</code></td>
<td><img alt="copy.gif" class="default" src="/@api/deki/files/3436/=copy.gif" style="height: 26px; width: 26px;"></td>
<td>Something is to be copied.</td>
</tr>
<tr style="cursor: move;">
<td><code>move</code></td>
<td><img alt="move.gif" src="/@api/deki/files/3443/=move.gif" style="height: 26px; width: 26px;"></td>
<td>Something is to be moved.</td>
</tr>
<tr style="cursor: no-drop;">
<td><code>no-drop</code></td>
<td><img alt="no-drop.gif" class="lwrap" src="/@api/deki/files/3445/=no-drop.gif" style="float: left; height: 26px; width: 33px;"></td>
<td>An item may not be dropped at the current location.<br>
{{bug("275173")}}: On Windows and Mac OS X, <code>no-drop</code> is the same as <code>not-allowed</code>.</td>
</tr>
<tr style="cursor: not-allowed;">
<td><code>not-allowed</code></td>
<td><img alt="not-allowed.gif" src="/@api/deki/files/3446/=not-allowed.gif" style="height: 26px; width: 26px;"></td>
<td>The requested action will not be carried out.</td>
</tr>
<tr id="grab" style="cursor: -moz-grab; cursor: -webkit-grab; cursor: grab;">
<td><code>grab</code></td>
<td><img alt="grab.gif" class="default" src="/@api/deki/files/3440/=grab.gif"></td>
<td>Something can be grabbed (dragged to be moved).</td>
</tr>
<tr style="cursor: -moz-grabbing; cursor: -webkit-grabbing; cursor: grabbing;">
<td><code>grabbing</code></td>
<td><img alt="grabbing.gif" class="default" src="/@api/deki/files/3441/=grabbing.gif"></td>
<td>Something is being grabbed (dragged to be moved).</td>
</tr>
<tr style="cursor: all-scroll;">
<th rowspan="15" scope="row" style="cursor: auto;">改變尺寸與捲軸尺</th>
<td><code>all-scroll</code></td>
<td><img alt="all-scroll.gif" src="/@api/deki/files/3433/=all-scroll.gif" style="height: 26px; width: 26px;"></td>
<td>Something can be scrolled in any direction (panned).<br>
{{bug("275174")}}: On Windows, <code>all-scroll</code> is the same as <code>move</code>.</td>
</tr>
<tr style="cursor: col-resize;">
<td><code>col-resize</code></td>
<td><img alt="col-resize.gif" src="/@api/deki/files/3435/=col-resize.gif" style="height: 26px; width: 26px;"></td>
<td>The item/column can be resized horizontally. Often rendered as arrows pointing left and right with a vertical bar separating them.</td>
</tr>
<tr style="cursor: row-resize;">
<td><code>row-resize</code></td>
<td><img alt="row-resize.gif" src="/@api/deki/files/3451/=row-resize.gif" style="height: 26px; width: 26px;"></td>
<td>The item/row can be resized vertically. Often rendered as arrows pointing up and down with a horizontal bar separating them.</td>
</tr>
<tr style="cursor: n-resize;">
<td><code>n-resize</code></td>
<td><img alt="Example of a resize towards the top cursor" src="/files/4083/n-resize.gif" style="border-style: solid; border-width: 0px; height: 26px; width: 26px;"></td>
<td rowspan="8" style="cursor: auto;">Some edge is to be moved. For example, the <code>se-resize</code> cursor is used when the movement starts from the <em>south-east</em> corner of the box.<br>
In some environments, an equivalent bidirectional resize cursor is shown. For example, <code>n-resize</code> and <code>s-resize</code> are the same as <code>ns-resize</code>.</td>
</tr>
<tr style="cursor: e-resize;">
<td><code>e-resize</code></td>
<td><img alt="Example of a resize towards the right cursor" src="/files/4085/e-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: s-resize;">
<td><code>s-resize</code></td>
<td><img alt="Example of a resize towards the bottom cursor " src="/files/4087/s-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: w-resize;">
<td><code>w-resize</code></td>
<td><img alt="Example of a resize towards the left cursor" src="/files/4089/w-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: ne-resize;">
<td><code>ne-resize</code></td>
<td><img alt="Example of a resize towards the top-right corner cursor" src="/files/4091/ne-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: nw-resize;">
<td><code>nw-resize</code></td>
<td><img alt="Example of a resize towards the top-left corner cursor" src="/files/4093/nw-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: se-resize;">
<td><code>se-resize</code></td>
<td><img alt="Example of a resize towards the bottom-right corner cursor" src="/files/4097/se-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: sw-resize;">
<td><code>sw-resize</code></td>
<td><img alt="Example of a resize towards the bottom-left corner cursor" src="/files/4095/sw-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: ew-resize;">
<td><code>ew-resize</code></td>
<td><img alt="3-resize.gif" class="default" src="/files/3806/3-resize.gif" style="height: 26px; width: 26px;"></td>
<td rowspan="4" style="cursor: auto;">Bidirectional resize cursor.</td>
</tr>
<tr style="cursor: ns-resize;">
<td><code>ns-resize</code></td>
<td><img alt="6-resize.gif" class="default" src="/files/3808/6-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: nesw-resize;">
<td><code>nesw-resize</code></td>
<td><img alt="1-resize.gif" class="default" src="/files/3805/1-resize.gif"></td>
</tr>
<tr style="cursor: nwse-resize;">
<td><code>nwse-resize</code></td>
<td><img alt="4-resize.gif" class="default" src="/files/3807/4-resize.gif" style="height: 26px; width: 26px;"></td>
</tr>
<tr style="cursor: -webkit-zoom-in; cursor: zoom-in;">
<th rowspan="2" scope="row" style="cursor: auto;">縮放</th>
<td><code>zoom-in</code></td>
<td><img alt="zoom-in.gif" class="default" src="/@api/deki/files/3459/=zoom-in.gif"></td>
<td rowspan="2" style="cursor: auto;">
<p>Something can be zoomed (magnified) in or out.</p>
</td>
</tr>
<tr style="cursor: -webkit-zoom-out; cursor: zoom-out;">
<td><code>zoom-out</code></td>
<td><img alt="zoom-out.gif" class="default" src="/@api/deki/files/3460/=zoom-out.gif"></td>
</tr>
</tbody>
</table>
</dd>
</dl>
<h3 id="公式語法">公式語法</h3>
<pre class="syntaxbox">{{csssyntax}}
</pre>
<h2 id="範例">範例</h2>
<pre class="brush:css">.foo {
cursor: crosshair;
}
.bar {
cursor: zoom-in;
}
/* A fallback keyword value is required when using a URL */
.baz {
cursor: url("hyper.cur"), auto;
}
</pre>
<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('CSS3 Basic UI', '#cursor', 'cursor')}}</td>
<td>{{Spec2('CSS3 Basic UI')}}</td>
<td>Addition of several keywords and the positioning syntax for <code>url()</code>.</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'ui.html#cursor-props', 'cursor')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<p>{{cssinfo}}</p>
<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
<p>{{Compat("css.properties.cursor")}}</p>
<h2 id="參照">參照</h2>
<ul>
<li><a href="/en-US/docs/CSS/Using_URL_values_for_the_cursor_property" title="Using URL values for the cursor property">Using URL values for the cursor property</a></li>
<li>{{cssxref("pointer-events")}}</li>
<li><a href="http://msdn.microsoft.com/en-us/library/aa358795.aspx">Cursor Property (MSDN)</a></li>
</ul>
|