
- HTML Home
- HTML Roadmap
- HTML Introduction
- HTML History & Evolution
- HTML Editors
- HTML Basic Tags
- HTML Elements
- HTML Attributes
- HTML Headings
- HTML Paragraphs
- HTML Fonts
- HTML Blocks
- HTML Style Sheet
- HTML Formatting
- HTML Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Frames
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Code Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Table Headers & Captions
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB & RGBA Colors
- HTML - HEX Colors
- HTML - HSL & HSLA Colors
- HTML - HSL Color Picker
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - Document Object Model (DOM)
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Character Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - DOM Style Object cursor Property
HTML DOM Style Object cursor property is used to set or grt the type of cursor to be displayed for the mouse pointer.
Syntax
Set the cursor property:object.style.cursor= value;Get the cursor property:
object.style.cursor;
Property Values
Value | Description |
---|---|
alias | It indicates shortcut or alias of something is to be created. |
all-scroll | It indicates scrolling in any direction. |
auto | It is default property where browser sets the cursor. |
cell | It indicates table cell or set of cells may be selected |
context-menu | It indicates the availability of a context menu. |
col-resize | It indicates a column can be resized horizontally. |
copy | It indicates something is to be copied. |
crosshair | In this property value, cursor renders as a crosshair. |
default | It represents the default cursor generally an arrow. |
e-resize | It indicates an edge of a box is to be moved to the right. |
ew-resize | It represents a bidirectional cursor. |
help | It indicates availability of help information. |
move | It indicates something is to be moved. |
n-resize | It indicates an edge of a box is to be moved up. |
ne-resize | It indicates that an edge of a box is to be moved up and right. |
nesw-resize | It indicates a bidirectional resize cursor. |
ns-resize | It indicates a bidirectional resize cursor. |
nw-resize | It indicates that an edge of a box is to be moved up and left. |
nwse-resize | It indicates a bidirectional resize cursor. |
no-drop | It indicates that the dragged item cannot be dropped here. |
none | It indicates no cursor is rendered for the element. |
not-allowed | It indicates that the requested action will not be executed. |
pointer | It represents cursor as a pointer and indicates link. |
progress | It indicates that the program is busy. |
row-resize | It indicates row can be resized vertically. |
s-resize | It indicates an edge of a box is to be moved down. |
se-resize | It indicates an edge of a box is to be moved down and right. |
sw-resize | It indicates an edge of a box is to be moved down and left. |
text | It indicates text which may be selected. |
URL | It indicates a comma-separated list of URLs to custom cursors. A generic cursor is specified at the end of the list in case if none of the URL-defined cursors can be used. |
vertical-text | It indicates vertical-text that may be selected. |
w-resize | It indicates an edge of a box is to be moved left. |
wait | It indicates that the program is busy. |
zoom-in | It indicates that something can be zoomed in. |
zoom-out | It indicates that something can be zoomed out. |
initial | It is used to set this property to it's default value. |
inherit | It is used to inherit the property of it's parent element. |
Return Value
It returns a string value which represents displayed mouse cursor when the mouse pointer is over an element.
Examples of HTML DOM Style Object 'cursor' Property
The following examples illustrates different property values of cursor property.
Set Various Cursor Values
In the following example we have changed cursor into pointer, cell, zoom-in and crosshair.
<!DOCTYPE html> <html lang="en"> <head> <title> HTML DOM Style Object cursor Property </title> </head> <body> <button onclick="crosshair()">Crosshair</button> <button onclick="pointer()">Pointer</button> <button onclick="cell()">Cell</button> <button onclick="zoomin()">Zoom-in</button> <p id="cursor"> This paragraph is for you to try different cursors. </p> <script> function crosshair() { document.getElementById("cursor") .style.cursor = "crosshair"; } function pointer() { document.getElementById("cursor") .style.cursor = "pointer"; } function cell() { document.getElementById("cursor") .style.cursor = "cell"; } function zoomin() { document.getElementById("cursor") .style.cursor = " zoom-in"; } </script> </body> </html>
Set Cursor Value to 'wait' and 'move'
The following example illustrates few more examples of cursor property like wait, move, help and ns-resize.
<!DOCTYPE html> <html lang="en"> <head> <title> HTML DOM Style Object cursor Property </title> </head> <body> <button onclick="help()">Help</button> <button onclick="move()">Move</button> <button onclick="nsresize()">ns-resize</button> <button onclick="wait()">Wait</button> <p id="cursor"> This paragraph is for you to try different cursors. </p> <script> function help() { document.getElementById("cursor") .style.cursor = "help"; } function move() { document.getElementById("cursor") .style.cursor = "move"; } function nsresize() { document.getElementById("cursor") .style.cursor = "ns-resize"; } function wait() { document.getElementById("cursor") .style.cursor = "wait"; } </script> </body> </html>
Supported Browsers
Property | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
cursor | Yes 1 | Yes 12 | Yes 1 | Yes 1.2 | Yes 7 |
html_dom.htm
Advertisements