Unstoppable Domains

[CSS] Custom cursors

Spaceship Spaceship
Watch

tm

Established Member
Impact
25
It's surprisingly easy to do custom cursors in CSS.

It's all controlled under the property cursor:
pointer is a hand (like hovering on a link) - useful for javascript OnClick links when the hand never happens.
default is just the original old cursor.
crosshair is a + symbol. Not very attractive.

Others include:
move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress
Which are pretty self-explanitory. (North East, north west, etc for the resize icons).

So how do you do a custom cursor?

put in your div/class/whatever:
Code:
    cursor: url(url/to/custom/cursor.ico), url(../url/to/custom/cursor), default;

let me go through this step by step.
Code:
 url(url/to/custom/cursor.ico)
This bring up the custom cursor file from the URL specified.
Code:
 url(../url/to/custom/cursor.ico)
is a hack for other browsers.

Code:
default;
justs makes the cursor default for unsupported browsers.

So how to make a .ico file?

Simple really. Make a 16x16 (max) file, decorate it or whatever and then save it as .gif (.ico if available). Then rename the .gif to .ico. Then call it in the css file.

Enjoy!
 
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
nice tip! Rep added
 
0
•••
No problem :)
 
0
•••
On 6YD I had a cursor problem. I wanted to have an "onClick" in a div but without using a link. To make it look like a link I used this code:
Code:
style="cursor: hand;cursor: pointer;"

That will bring up the default link cursor. There are also a load of other default cursors (I don't know off the top of my head) but you can use them like that! :)

Hope this adds to your informative thread nicely! :) Thanks for the info though, it could come in useful at some point. I remember trying in vain to find out how to do that! :)
 
0
•••
Yep,

Here is the list:

Default | pointer | Crosshair | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress

Thanks for your extra info :)
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back