NamePros.Com (http://www.namepros.com/)
-   CODE (http://www.namepros.com/code/)
-   -   [CSS] Custom cursors (http://www.namepros.com/code/197904-css-custom-cursors.html)

tm 05-16-2006 09:21 AM

[CSS] Custom cursors
 
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!

wvccboy 05-16-2006 11:48 AM

nice tip! Rep added

tm 05-28-2006 02:34 AM

No problem :)

PoorDoggie 06-03-2006 12:40 PM

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! :)

tm 06-04-2006 01:56 AM

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 :)


All times are GMT -7. The time now is 06:09 AM.
Site Sponsors
Advertise your business at NamePros

Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0