How to Style Your Cursor with CSS3

There are so many different ways to style your cursor using CSS3. Most developers probably know about cursor: pointer, but what about the dozens of other ways to have your cursor appear? What follows is a list of some of the most useful cursor styles. Combine them with the :hover pseudo-selector for your styling to take effect once the designated HTML element has been hovered upon.

Crosshair

Join us in our newest publication:

This will make your cursor render as a crosshair symbol.

  1. .element:hover{
  2. cursor: crosshair;
  3. }

Wait

This will render your cursor as an animated icon (the spinning ball we’re sadly all so familiar with) to indicate that the user has to wait for the program to catch up, or that something is in progress.

  1. .element:hover{
  2. cursor: wait;
  3. }

Alias

When your cursor is rendered as an alias icon, that usually means that an action can be performed that will create an alias or a copy of something.

  1. .element:hover{
  2. cursor: alias;
  3. }

Copy

The description of the copy function probably sounds very similar to alias, but the icons for each value are very different. While the alias icon is a curved arrow, the copy symbol is a cursor with a ‘plus’ icon attached, indicating that something can be copied.

  1. .element:hover{
  2. cursor: copy;
  3. }

Zoom

The zoom-in and z00m-out values are pretty self explanatory. Zoom-in is an icon with a plus in the center, while zoom-out is the same icon but with a minus in the center.

  1. .element:hover{
  2. cursor: zoom-in;
  3. }
  4.  
  5. </pre>
  6. <pre>.other-element:hover{
  7. cursor: zoom-out;
  8. }</pre>
  9. <pre>

*cursors may render differently on different browsers.

Share and Enjoy !

0Shares
0 0