Cursor in HTML property controls the shape or look and feel of the cursor when it is hovering on any HTML element by using a specific type of cursor property. This concept is applicable only for whatever devices have a cursor and mouse; if not, this feature could any relevant results with cursor property. The purpose of this cursor property is in using images for submitting buttons on any forms. Whenever an end-user hovers over an image, then if that is a submit button, automatically it gives you a clue that the image is working as a button by clicking it.
How does Cursor Property work in HTML?
HTML cursor property works based on style property within HTML tag. We will investigate some different cursor syntax in HTML.
Syntax #1
1 | <span style= "cursor:auto" >auto</span>
|
Copy after login
Syntax #2
1 | <span style= "cursor:crosshair" >crosshair</span>
|
Copy after login
Syntax #3
1 | <span style= "cursor:default" > default </span>
|
Copy after login
Syntax #4
1 | <span style= "cursor:e-resize" >e-resize</span>
|
Copy after login
Syntax #5
1 | <span style= "cursor:help" >help</span>
|
Copy after login
Syntax #6
1 | <span style= "cursor:move" >move</span>
|
Copy after login
Syntax #7
1 | <span style= "cursor:n-resize" >n-resize</span>
|
Copy after login
Syntax #8
1 | <span style= "cursor:ne-resize" >ne-resize</span>
|
Copy after login
Syntax #9
1 | <span style= "cursor:nw-resize" >nw-resize</span>
|
Copy after login
Syntax #10
1 | <span style= "cursor:pointer" >pointer</span>
|
Copy after login
Syntax #11
1 | <span style= "cursor:progress" >progress</span>
|
Copy after login
Syntax #12
1 | <span style= "cursor:s-resize" >s-resize</span>
|
Copy after login
Syntax #13
1 | <span style= "cursor:se-resize" >se-resize</span>
|
Copy after login
Syntax #14
1 | <span style= "cursor:sw-resize" >sw-resize</span>
|
Copy after login
Syntax #15
1 | <span style= "cursor:text" >text</span>
|
Copy after login
Syntax #16
1 | <span style= "cursor:w-resize" >w-resize</span>
|
Copy after login
Syntax #17
1 | <span style= "cursor:wait" >wait</span>
|
Copy after login
Cursor Values and its Description Table
サイズ変更行のサイズ変更n-リサイズ
Type |
HTML Value |
How Cursor Look Like? |
Description |
|
General |
auto |
|
Based on the text cursor will change automatically. |
|
default |
 |
By default, an arrow cursor. |
|
none |
|
No cursor is displayed. |
|
Links & Status |
context-menu |
 |
Cursor like context menu |
|
help |
 |
Help information with an arrow question mark. |
|
pointer |
 |
Pointer symbol with a hand like a cursor. |
|
progress |
 |
Says program is busy and can able to interact with the application. |
|
wait |
 |
Says program is busy and cannot able to interact with the application. |
|
Selection |
cell |
 |
Cells can be selected from the table showing the cursor. |
|
crosshair |
 |
Cross cursor used for selection. |
|
text |
 |
An I-beam cursor used for the selected text. |
|
vertical-text |
 |
A sideway I-beam cursor used for the vertical selected text. |
|
Drag & Drop |
alias |
 |
shortcut cursor |
|
copy |
 |
Copied cursor |
|
move |
 |
the element can be moved with the cursor. |
|
no-drop |
|
アイテムはドロップされず、カーソルが表示されています。 |
|
|
許可されません |
 |
リクエストではカーソル アクションを前方に持ち越すことはできません。 |
|
掴む |
 |
カーソルを掴んだ |
|
掴む |
 |
何かがカーソルを掴んでいます。 |
|
サイズ変更とスクロール |
全スクロール |
|
 |
|
|
|
カーソルを表示して特定の方向にスクロールします。
|
|
|
|
|
項目/列は水平方向にサイズ変更できます。
|
|
|
|
項目/列は垂直方向にサイズ変更できます。
|
|
|
|
カーソルを示す特定の表示方向に移動したエッジ。
|
|
電子サイズ変更
|
|
|
s-リサイズ
|
|
|
w-resize
|
|
|
再サイズ
|
|
|
nw-resize
|
|
|
サイズ変更
|
|
|
sw-resize
|
|
|
新規サイズ変更 |
|
双方向のサイズ変更カーソル。
|
|
ns-resize
|
|
|
新しいサイズ変更
|
|
|
nwse-resize
|
|
ズーム |
|
ズームイン |
|
カーソルを表示するズームインとズームアウト
|
|
ズームアウト
Examples to Implement Cursor in HTML
Below are the examples mentioned:
Example #1
Links and Status showing cursors.
Code:
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 | <!DOCTYPE html>
<html>
<head>
<meta charset= "ISO-8859-1" >
<title>Cursors in HTML</title>
<style type= "text/css" >
.div2 {
border: 1px solid brown;
color: green;
width: 900px;
font-size: 20px;
}
.div3 {
border: 1px solid brown;
color: red;
width: 900px;
font-size: 20px;
}
.div4 {
border: 1px solid brown;
color: blue;
width: 900px;
font-size: 20px;
}
.div5 {
border: 1px solid brown;
color: lime;
width: 900px;
font-size: 20px;
}
</style>
</head>
<body>
<div class = "div2" >
<h3 style= "text-align: center" >Progress Cursor Demo</h3>
<span style= "cursor: progress" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div3" >
<h3 style= "text-align: center" >Help Cursor Demo</h3>
<span style= "cursor: help" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div4" >
<h3 style= "text-align: center" >Pointer Cursor Demo</h3>
<span style= "cursor: pointer" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div5" >
<h3 style= "text-align: center" >Wait Cursor Demo</h3>
<span style= "cursor: wait" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
</html>
|
Copy after login
Output:

Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Example #2
Selection showing cursors
Code:
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 | <!DOCTYPE html>
<html>
<head>
<meta charset= "ISO-8859-1" >
<title>Cursors in HTML</title>
<style type= "text/css" >
.div2 {
border: 1px solid blue;
color: fuchsia;
width: 900px;
font-size: 20px;
}
.div3 {
border: 1px solid blue;
color: gray;
width: 900px;
font-size: 20px;
}
.div4 {
border: 1px solid blue;
color: maroon;
width: 900px;
font-size: 20px;
}
</style>
</head>
<body>
<div class = "div2" >
<h3 style= "text-align: center" >Cross hair Cursor Demo</h3>
<span style= "cursor: crosshair" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div3" >
<h3 style= "text-align: center" >Horizontal Text Cursor Demo</h3>
<span style= "cursor: text" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div4" >
<h3 style= "text-align: center" >Vertical Text Cursor Demo</h3>
<span style= "cursor: vertical-text" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
</html>
|
Copy after login
Output:

Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Example #3
Drag and drop showing cursors.
Code:
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 | <!DOCTYPE html>
<html>
<head>
<meta charset= "ISO-8859-1" >
<title>Cursors in HTML</title>
<style type= "text/css" >
.div2 {
border: 1px solid red;
color: orange;
width: 900px;
font-size: 20px;
}
.div3 {
border: 1px solid red;
color: olive;
width: 900px;
font-size: 20px;
}
.div4 {
border: 1px solid red;
color: navy;
width: 900px;
font-size: 20px;
}
.div5 {
border: 1px solid red;
color: lime;
width: 900px;
font-size: 20px;
}
.div6 {
border: 1px solid red;
color: blue;
width: 900px;
font-size: 20px;
}
.div7 {
border: 1px solid red;
color: maroon;
width: 900px;
font-size: 20px;
}
</style>
</head>
<body>
<div class = "div2" >
<h3 style= "text-align: center" >Alias Cursor Demo</h3>
<span style= "cursor: alias" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div3" >
<h3 style= "text-align: center" > Copy Cursor Demo</h3>
<span style= "cursor: copy" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div4" >
<h3 style= "text-align: center" >Move Cursor Demo</h3>
<span style= "cursor: move" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div5" >
<h3 style= "text-align: center" >No-drop Cursor Demo</h3>
<span style= "cursor: no-drop" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div6" >
<h3 style= "text-align: center" >Grab Cursor Demo</h3>
<span style= "cursor: grab" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div7" >
<h3 style= "text-align: center" >Not-allowed Cursor Demo</h3>
<span style= "cursor: not-allowed" >Cursor in HTML property
controls shape or look and feel of the cursor when it is hovering on
the any HTML element by using specific type of cursor property.</span>
</div>
</html>
|
Copy after login
Output:


Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Example #4
Selection showing cursors.
Code:
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 | <!DOCTYPE html>
<html>
<head>
<meta charset= "ISO-8859-1" >
<title>Cursors in HTML</title>
<style type= "text/css" >
.div2 {
border: 1px solid fuchsia;
color: teal;
width: 900px;
font-size: 20px;
}
.div3 {
border: 1px solid fuchsia;
color: purple;
width: 900px;
font-size: 20px;
}
</style>
</head>
<body>
<div class = "div2" >
<h3 style= "text-align: center" >Zoom-in Cursor Demo</h3>
<span style= "cursor: zoom-in" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
<br>
<div class = "div3" >
<h3 style= "text-align: center" >Zoom-out Cursor Demo</h3>
<span style= "cursor: zoom-out" >Cursor in HTML property controls
shape or look and feel of the cursor when it is hovering on the any
HTML element by using specific type of cursor property.</span>
</div>
</html>
|
Copy after login
Output:

Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Conclusion
Cursor property works based on property value given to the cursor. Based on the requirement, we choose which cursor action required at the instant.
The above is the detailed content of Cursor in HTML. For more information, please follow other related articles on the PHP Chinese website!