Grow your CSS skills. Land your dream job.

Hover state without anchor???

  • # July 15, 2009 at 7:42 pm

    Hi,

    Is there a CSS only, multi-brower (including IE6) way I can set up an image to change when I hover over it?

    I can achieve it using sprites and the hover state on an anchor link, but I don’t want it to be a link. Either that or I don’t want the link to be active (using href="#" seems to jump to the top of the page and make the image disappear???). Problem with that of course is that the markup won’t be valid with a link doesn’t actually link to anything (I believe). Is there anything I can do within the anchor tag that will make absolutely nothing happen when it is clicked on?

    I want to avoid using JS but if there is no other way, so be it.

    Thanks for any help

    # July 15, 2009 at 9:16 pm

    I have done it with JS using onmouseover/onmouseout and the setTimeout() method. I know you are looking for a "pure" css way of doing it, but if you can’t get anything and need help on the js end, let me know and I will get soem code together for you….

    # July 16, 2009 at 12:24 am

    As far as I know, you’ll need to use some JS.

    # July 17, 2009 at 7:42 pm

    The W3C (http://www.w3schools.com/css/pr_pseudo_hover.asp) only use the hover pseudo class in conjunction with an anchor link… For what it’s worth, I’ve never seen it used otherwise.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".