Cursor do Mouse


Os valores CSS para o cursor

Abaixo uma lista com os valores CSS admitidos para estilização do cursor.

Passe o mouse sobre o valor, para ver o aspecto do cursor.

cursor: wait
cursor: crosshair
cursor: n-resize
cursor: se-resize
cursor: help
cursor: text
cursor: ne-resize
cursor: sw-resize
cursor: pointer
cursor: move
cursor: nw-resize
cursor: e-resize
cursor: default
cursor: w-resize
cursor: s-resize

CSS3 Cursor Styles

We have more styles to choose from in CSS3. These work in IE9 and the latest versions of Firefox, Chrome, Safari and Opera except where indicated:

cursor: none (not IE, Safari, Opera)
cursor: context-menu (not Firefox, Chrome)
cursor: cell (not Safari)
cursor: vertical-text
cursor: alias (not Safari)
cursor: copy (not Safari)
cursor: no-drop
cursor: not-allowed
cursor: ew-resize
cursor: ns-resize
cursor: nesw-resize
cursor: nwse-resize
cursor: col-resize
cursor: row-resize
cursor: all-scroll

Browser-Specific Cursors

Mozilla and some editions of Chrome and Safari offer a number of vendor-prefixed cursor styles which are likely to become part of the CSS3 specification:

cursor: -webkit-grab; cursor: -moz-grab;
cursor: -webkit-grabbing; cursor: -moz-grabbing;
cursor: -webkit-zoom-in; cursor: -moz-zoom-in;
cursor: -webkit-zoom-out; cursor: -moz-zoom-out;

Creating Your Own Cursor

Finally, you can create your own cursor graphic, e.g

Sintaxe:
cursor: url(images/cursor.png) x y, auto;

Cursor Transparente

cursor: url(images/cursor.png) 19 19, auto;

Cursor Animado

cursor: url(images/cursor_animado.gif) 30 30, auto;

Note:

  1. Internet Explorer requires a Windows cursor file (.cur).
  2. Firefox, Chrome and Safari require an image — I’d recommend a 24-bit alpha-transparent PNG.
  3. Firefox also requires a second non-URL cursor fallback value.
  4. It’s not supported in Opera.
  5. x and y are optional properties in Firefox, Chrome and Safari which define the precise pointer position from the top-left of the graphic. If omitted, 0 0 is assumed.

Nice, but it sounds like too much effort to me! I’ll be sticking with the standard cursor styles…

Cursor Animado

Também é possível utilizar um cursor personalizado:

O código para um cursor da Internet, seria o seguinte, recomendo-lhe que utilize a Folha de Estilos CSS, que pode ser encontrada em:

cursor: url('Endereço do cursor');

Em Endereço do cursor, aqui deverá adicionar o endereço do seu cursor, mas lembre-se de que ele deve terminar em ".png".

<html>
<head>
<title>Untitled Document</title>
</head>
<style TYPE="text/css">
<!--
#cursor {
cursor: url("images/cursor.png") 19 19, auto;
}
-->
</style>
<body>
<p id="cursor" style="width:400px; height400px; background-color:#00FF99">&nbsp;</p>
</body>
</html>

Passe o mouse em cima do quadrado e veja o resultado: