- CSS Tutorial
- CSS Introduction
- CSS Syntax
- CSS Comments
- CSS Selectors
- CSS Fonts
- CSS Colors
- CSS Backgrounds
- CSS Box Model
- CSS Borders
- CSS Margins
- CSS Padding
- CSS Text
- CSS Images
- CSS Links
- CSS Lists
- CSS Tables
- CSS Outline
- CSS Icons
- CSS Display
- CSS max-witdh
- CSS Position
- CSS z-index
- CSS Overflow
- CSS Float
- CSS Align
- CSS Opacity
- CSS Navigation Bar
- CSS Dropdowns
- CSS Forms
- CSS Units
- CSS !important
- CSS Specificity
- CSS Combinators
- CSS inline-block
- CSS Hover
- CSS Cursors
- CSS Selectors
- CSS Type Selector
- CSS Class Selector
- CSS ID Selector
- CSS Attribute Selector
- CSS Pseudo-class Selector
- CSS Pseudo-element Selector
- CSS Universal Selector
- CSS Advanced
- CSS Text Formatting
- CSS Gradients
- CSS Shadow
- CSS Rounded Corners
- CSS Text Effects
- CSS 2D Transform
- CSS 3D Transform
- CSS Border Images
- CSS Inherit
- CSS Transitions
- CSS Animations
- CSS Box Sizing
- CSS Tooltip
- CSS Masking
- CSS Pagination
- CSS Styling Images
- CSS object-fit
- CSS object-position
- CSS Buttons
- CSS Multiple Columns
- CSS Variables
- CSS Flexbox
- CSS Grid
- CSS Media Queries
CSS Cursors
In CSS, the cursor property is one of the most effective tools for improving User Experience (UX). It allows you to change the appearance of the mouse pointer when it hovers over specific elements. By switching the cursor, you provide immediate visual feedback, telling the user what an element does—whether it’s clickable, draggable, or currently disabled—before they even click.
Here are the most common values you can use for the cursor property, categorized by their typical use cases:
auto: The browser determines the best cursor based on the context. For instance, it displays a text cursor over text and a default arrow over empty space.default: The standard platform cursor, which is usually an arrow. This is often used on non-interactive areas of a page.none: The cursor is completely hidden. This is useful for immersive experiences like fullscreen video players or games where the mouse might be distracting.pointer: A hand icon, which is the universal signal for a link or a clickable item. While browsers do this automatically for<a>tags, you should manually apply it to custom buttons, tabs, or interactive div elements.text: Indicates that the text can be highlighted or selected. This is the default behavior for paragraphs and headings, but you might use it on custom input fields.crosshair: Displays a thin cross. This is common in photo editing tools, map interfaces, or applications where precise selection or "drawing" is required.move: Indicates that an element (like a modal window or a list item) can be moved or dragged.not-allowed: Displays a circle with a line through it. This is perfect for showing that a button is disabled or that a specific action is currently blocked.wait: Indicates that the application is busy in the background (e.g., saving data) and the user should wait before interacting again.help: Usually appears as a question mark or a balloon. Use this for tooltips or "What is this?" icons to show that more information is available on hover.resizedirections (e.g.,n-resize,e-resize,s-resize,w-resize): These indicate that an edge of an element can be resized in a specific cardinal direction (North, East, South, West).resizediagonals (e.g.,ne-resize,nw-resize,se-resize,sw-resize): These indicate that a corner can be resized diagonally. These are essential for building resizable sidebars or dashboard widgets.zoom-in/zoom-out: These indicate that an image or a section of a page can be magnified or shrunk. These are commonly used in image galleries.
cursor: none; with extreme caution. If you hide the cursor without providing a clear way to navigate, you may make your site completely unusable for many visitors.
cursor: pointer; to custom <button> elements or clickable <div> components. Without it, users may not realize the element is interactive.
grab and grabbing for drag-and-drop interfaces. They provide even better feedback than move by showing a hand that "clenches" when the user clicks down.
Beyond the built-in cursors, CSS allows you to get creative by defining custom cursors using an image. This is a great way to reinforce your brand's personality.
Example: Custom Cursor Implementation
.custom-cursor {
/* The URL points to the image, 'auto' is the mandatory fallback */
cursor: url('custom-pointer.png'), auto;
}
auto or pointer after the URL.
By mastering the cursor property, you can bridge the gap between a static design and a truly interactive, intuitive web application.