CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress
CSS Reference

Quick Reference

The cursor property specifies the type of mouse cursor to be displayed when over an element. Otherwise, the default cursor will be shown.

				
					.my_div {
    cursor: crosshair;
}
				
			

Values

Default value auto
Inherited values yes
Can it be animated? no

These are the allowed values.

ValueDescription
aliasThe cursor indicates an alias of something is to be created
all-scrollThe cursor indicates that something can be scrolled in any direction
autoThe browser sets a cursor (default)
cellThe cursor indicates that a cell (or set of cells) may be selected
context-menuThe cursor indicates that a context-menu is available
col-resizeThe cursor indicates that the column can be resized horizontally
copyThe cursor indicates something is to be copied
crosshairThe cursor render as a crosshair
defaultThe default cursor for the element it’s over or for what the user is doing with it
e-resizeThe cursor indicates that an edge of a box is to be moved right
ew-resizeIndicates a bidirectional resize cursor
grabThe cursor indicates that something can be grabbed
grabbingThe cursor indicates that something can be grabbed
helpThe cursor indicates that help is available
moveThe cursor indicates something is to be moved
n-resizeThe cursor indicates that an edge of a box is to be moved up
ne-resizeThe cursor indicates that an edge of a box is to be moved up and right
nesw-resizeIndicates a bidirectional resize cursor
ns-resizeIndicates a bidirectional resize cursor
nw-resizeThe cursor indicates that an edge of a box is to be moved up and left
nwse-resizeIndicates a bidirectional resize cursor
no-dropThe cursor indicates that the dragged item cannot be dropped here
noneNo cursor is rendered for the element
not-allowedThe cursor indicates that the requested action will not be executed
pointerThe cursor is a pointer and indicates a link
progressThe cursor indicates that the program is busy
row-resizeThe cursor indicates that the row can be resized vertically
s-resizeThe cursor indicates that an edge of a box is to be moved down
se-resizeThe cursor indicates that an edge of a box is to be moved down and right
sw-resizeThe cursor indicates that an edge of a box is to be moved down and left
textThe cursor indicates text that may be selected
URLA comma separated list of URLs to custom cursors (always specify a generic cursor at the end of the list, in case the custom cursors fail to load)
vertical-textThe cursor indicates vertical-text that may be selected
w-resizeThe cursor indicates that an edge of a box is to be moved left
waitThe cursor indicates that the program is busy
zoom-inThe cursor indicates that something can be zoomed in
zoom-outThe cursor indicates that something can be zoomed out
initialSets this property to its default value
inheritInherits this property from its parent element

Using JavaScript

The HTML element can also be styled using JavaScript and the element’s id.

				
					document.getElementById('my_div').style.cursor = 'crosshair';
				
			
				
					<button onclick='my_function()'>Click Here</button>

<script>
function my_function() {
    document.getElementById('my_div').style.cursor = 'crosshair';
}
</script>
				
			

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.

CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress

Why 1SMARTchicken?

This site was built and is maintained to benefit my autistic son.
See More →

My Son's Name is Johnny

He was diagnosed as autistic quite late, at age four...
His story

Buy Me a Coffee

Thanks for your support!

Feedback

If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.