posted April 9, 2008  

Have you ever wanted to have the pointer turn into a hand, like it does for links, when it goes over a certain div? I’ve had the need to do so a few times for Javascript dropdown menus. Of course you can include the Javascript function in <a></a> tags to get the same effect. But what if you want to execute the function during a onMouseOver event?

The solution is simple. It’s probably too simple, but a solution nonetheless.

The CSS:

<style type="text/css">
#mouseover
{
    cursor:pointer;
    cursor:hand;
}
</style>

<html>
    <body>
        <div id="mouseover">
            Some function
        </div>
    </body>
</html>

Explanation:

You need cursor:pointer because NS only recognizes this. You need cursor:hand for IE5, which I don’t really worry about too much anymore. IE6, thankfully, recognizes both of these, and so do the rest of the browsers.

And this is how it should behave:

Some function

Enjoy!

filed under: general

tags: , , , , ,


comments:
no comments yet.
leave a comment:
Copyright © 2008-2009 csswoes.com • Bryan Duran • All Rights Reserved