Coding Schools


 
Python | C Sharp | Azure AI | HTML | JavaScript | CSS | SQL Server
How to add CSS in HTML
Types of CSS Files
Flex in CSS
Media Query in CSS
CSS - background attribute
CSS - border
css - border-image
CSS align attributes
CSS color attribute
CSS cursor attribute
CSS display attribute
CSS font attributes
CSS height and max-height
CSS width and max-width
CSS padding attributes
CSS margin attributes
CSS mask attributes
CSS overflow attributes
CSS opacity attribute
CSS text decoration attributes
CSS visibility attribute
CSS word attributes
CSS z-index attribute

CSS cursor attribute



The cursor property in CSS is used to specify the type of cursor to display when the mouse pointer is over an element. Here are some common values you can use:

Basic Usage

css
.element {
    cursor: pointer; /* Hand cursor */
}

Common Cursor Values

  • default: The default cursor (usually an arrow).

  • pointer: A hand cursor, typically used for links.

  • text: A text cursor (I-beam), used for text areas and input fields.

  • move: A cursor indicating something is movable.

  • not-allowed: A cursor indicating an action is not allowed.

  • help: A help cursor, often a question mark.

  • crosshair: A crosshair cursor.

  • wait: An hourglass or spinner, indicating something is loading.

  • zoom-in: A magnifying glass with a plus sign, indicating zoom-in functionality.

  • grab and grabbing: Cursors indicating dragging functionality.

Example

Here is an example of different cursor types in CSS:

css
/* Default cursor */
.default {
    cursor: default;
}

/* Pointer cursor */
.pointer {
    cursor: pointer;
}

/* Text cursor */
.text {
    cursor: text;
}

/* Move cursor */
.move {
    cursor: move;
}

/* Not-allowed cursor */
.not-allowed {
    cursor: not-allowed;
}

Custom Cursors

You can also use custom images for cursors:

css
.custom {
    cursor: url('path/to/cursor.png'), auto;
}

Feel free to use these examples to customize the cursor behavior in your project. Let me know if you need further assistance!




All rights reserved | Privacy Policy | Sitemap