Results 1 to 5 of 5

Thread: Custom Cursor on mouseover possible?

  1. #1
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Custom Cursor on mouseover possible?

    Is it possible?

    style="cursor:url("mycursor.cur");"

    I wanted to have that in a link, for example:
    <A HREF="URL" style="cursor:url("mycursor.cur");"></A>
    As far as I know, that syntax will not work, but if anyone can tell me a way to have a cutom Cursor on mouseover, let me know.

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Soots
    Is it possible?
    Yes[1], but only via a proper style sheet, and then only on a elements[2].

    Code:
    <head>
      <!-- ... -->
    
      <style type="text/css">
        selector:hover {
          cursor: url(...), fallback;
        }
      </style>
    </head>
    What you'll use in place of selector and fallback will vary based on what you're trying to style, and where. The fallback value will probably be default but I couldn't guess at selector without seeing at least a sample of your mark-up in context.

    Mike


    [1] At least in IE. I can't recall any other user agents supporting custom cursors.
    [2] You can apply the :hover pseudo-class to any element, but IE only supports it with a elements, unlike most user agents.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Soots
    <A HREF="URL" style="cursor:url("mycursor.cur");"></A>
    Actually this would work but, you've used incorrect quoting. Use:
    HTML Code:
    <A HREF="URL" style="cursor:url('mycursor.cur');"></A>
    It will be fine in IE6 and Modern Mozilla, however only IE6 will display it. Some browsers may get confused by it however, and act unpredictably.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks jscheuer1

    It works now thanks, you guys are awsome.

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I cite tiredness for the travesty that was my previous post.

    The use of the :hover pseudo-class isn't necessary, however it would be better to use a style sheet rule, rather than inline style attributes if the custom cursor is to be applied to more than one element.

    The fallback value that I was thinking of was auto not default. Please note that a standard cursor type is mandatory. Even if IE accepts the declaration now, it might not in the future as Microsoft are making some moves towards better conformance.

    As for the quotes within the attribute, the easier alternative is omit them altogether.

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •