Introduction to Cursor in HTML

Cursor in HTML

Introduction to Cursor in HTML

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

<span style="cursor:auto">auto</span>

Syntax #2

<span style="cursor:crosshair">crosshair</span>

Syntax #3

<span style="cursor:default">default</span>

Syntax #4

<span style="cursor:e-resize">e-resize</span>

Syntax #5

<span style="cursor:help">help</span>

Syntax #6

<span style="cursor:move">move</span>

Syntax #7

<span style="cursor:n-resize">n-resize</span>

Syntax #8

<span style="cursor:ne-resize">ne-resize</span>

Syntax #9

<span style="cursor:nw-resize">nw-resize</span>

Syntax #10

<span style="cursor:pointer">pointer</span>

Syntax #11

<span style="cursor:progress">progress</span>

Syntax #12

<span style="cursor:s-resize">s-resize</span>

Syntax #13

<span style="cursor:se-resize">se-resize</span>

Syntax #14

<span style="cursor:sw-resize">sw-resize</span>

Syntax #15

<span style="cursor:text">text</span>

Syntax #16

<span style="cursor:w-resize">w-resize</span>

Syntax #17

<span style="cursor:wait">wait</span>

Cursor Values and its Description Table

TypeHTML ValueHow Cursor Look Like?Description
GeneralautoBased on the text cursor will change automatically.
defaultdefaultBy default, an arrow cursor.
noneNo cursor is displayed.
Links & Statuscontext-menuCursor like context menu
helpHelp information with an arrow question mark.
pointerpointerPointer symbol with a hand like a cursor.
progressprogressSays program is busy and can able to interact with the application.
waitwaitSays program is busy and cannot able to interact with the application.
SelectioncellcellCells can be selected from the table showing the cursor.
crosshaircrosshairCross cursor used for selection.
texttextAn I-beam cursor used for the selected text.
vertical-textCursor in html - 10A sideway I-beam cursor used for the vertical selected text.
Drag & Dropaliasaliasshortcut cursor
copyCursor in html - 12Copied cursor
moveCursor in html - 13the element can be moved with the cursor.
no-dropCursor in html - 14Item was not dropped, showing cursor.
not-allowedCursor in html - 15Request canโ€™t carry forward cursor action.
grabCursor in html - 16Grabbed cursor
grabbingCursor in html - 17Something being grabbed cursor.
Resizing & Scrollingall-scrollCursor in html - 18Scrolled in any specific direction showing cursor.
col-resizeCursor in html - 19The item/column can be resized horizontally.
row-resizeCursor in html - 20The item/column can be resized Vertically.
n-resizeCursor in html - 21Any edge moved in a specific shown direction showing cursor.
e-resizeCursor in html - 40
s-resizeCursor in html - 23
w-resizeCursor in html - 24
ne-resizeCursor in html - 25
nw-resizeCursor in html - 26
se-resizeCursor in html - 27
sw-resizeCursor in html - 28
ew-resizeBidirectional resize cursor.
ns-resizeCursor in html - 30
nesw-resizeCursor in html - 31
nwse-resizeCursor in html - 32
Zoomingzoom-inZoom-in and zoom-out showing cursor
zoom-outCursor in html - 34

Examples to Implement Cursor in HTML

Below are the examples mentioned:

Example #1

Links and Status showing cursors.

Code: 

<!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>

Output:

Cursor in html - 35

Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.

Example #2

Selection showing cursors

Code:

<!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>

Output:

Selection showing

Explanation: In the above output, click any paragraph for seeing the corresponding cursor output. Popular Course in this categoryHTML Training (12 Courses, 19+ Projects, 4 Quizzes)12 Online Courses | 19 Hands-on Projects | 89+ Hours | Verifiable Certificate of Completion | Lifetime Access | | 4 Quizzes with Solutions
4.5 (6,502 ratings)Course Price
โ‚น6999 โ‚น41999
View Course


Related CoursesBootstrap Training (2 Courses, 6+ Projects)XML Training (5 Courses, 6+ Projects)CSS Training (9 Courses, 9+ Projects)

Example #3

Drag and drop showing cursors.

Code:

<!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>

Output:

Drag and drop showing
Cursor in html - 38

Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.

Example #4

Selection showing cursors.

Code:

<!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>

Output:

Selection showing

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.

Recommended Articles

This is a guide to Cursor in HTML. Here we discuss different cursor syntax in HTML, types of a cursor, and examples for better understanding. You can also go through our other related articles to learn more โ€“

  1. HTML Image Padding
  2. Area Tag in HTML
  3. HTML frameset Tag
  4. Cursor in MySQL

Leave a Comment

Your email address will not be published. Required fields are marked *