Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I stop the name anchors from picking up hover attributes?

    How do I stop the name anchors from picking up hover attributes?

    Okay I hope that question makes sense.

    On a website I've just developed, I use a lot of anchors to jump around on the pages. I notice that the named anchors pick up the same hover attributes as the links themselves. In case that makes no sense, here's an example. See this page:

    http://www.vehiclefinanceconference.com/schedule.html

    If I run my cursor over the dark blue heading that says "WEDNESDAY, JANUARY 31, 2007" those words change to the hover color/size of the links in the document. Even though that's the named anchor rather than the link. Is there a way I can prevent that from happening? I mean, I guess I could specify the name without putting anything inside it (<a name="Wednesday"></a>), but I always thought the name was supposed to surround the words.

    Any ideas? Does my question make sense?

    Thanks, Phyllis

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Try a:link:hover instead of just a:hover.

  • #3
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No go -- that removes all the hover effects. :-( I also tried A:hover link but that doesn't work either. Weird.

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    You can always do a[href]:hover

  • #5
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,785
    Thanks
    6
    Thanked 1,022 Times in 995 Posts
    That will not work in IE 6. You shouldn't use named anchors anyway as this method is kinda deprecated (depending on what version of HTML you're using). Any element with an ID can be referenced as anchor point:

    Code:
    <div id="here"></div>
    
    
    <!-- will jump to the element with ID 'here' -->
    <a href="#here>link</a>
    (or a URL like: http://example.com/index.htm#here will jump to that element too)

  • #6
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's it!!! Thank you so much!!!!!!

    :-)

    Phyllis

  • #7
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Dang it! Just realized that works in Firefox but not in IE. IE no longer recognizes any of the link attributes. :-(

  • #8
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually I also just realized that it's only Firefox that's applying the hover effects to the name anchors (IE doesn't). Wonder if I can spec it for both somehow? (Most all my readers will be using Explorer with a handful using Firefox.)

    Any ideas?

    Thanks, Phyllis

  • #9
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh I just saw the post from VIPStephan. Dang I have millions of instances of the named anchor in use. :-( Guess I need to learn newer HTML. Maybe I can still figure something out though....

    Thanks, Phyllis

  • #10
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    If IE has the desired behavior and Firefox doesn't:
    Code:
    * html a:hover, a[href]:hover {
    
    }
    That should take care of it?

  • #11
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hm, couldn't get it to work just now but I'll try again in a bit (ugh, got busy at work). Will report back on whether I have any progress.... Thanks for all the help!

  • #12
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,338
    Thanks
    29
    Thanked 282 Times in 276 Posts
    Change: <h3><a name="Wednesday">WEDNESDAY, JANUARY 31, 2007</a></h3>
    To: <h3 id="Wednesday">WEDNESDAY, JANUARY 31, 2007</h3>

    Using name attributes to refer to part of a document is deprecated (obsolete) in favor of id attribute references.

    Problems with the browsers may be related to the page being rendered in backward‐compatibility (quirks) mode in both Firefox and Internet Explorer. The page is being rendered in that mode because the HTML isn’t properly declared; the document type declaration is missing. The document also contains numerous errors. Additionally, the CSS document contains errors.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #13
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for everything. I'm slowly trying to change the names to ids as I work on different pages of my websites. I appreciate the help!

    Phyllis

  • #14
    New Coder
    Join Date
    May 2003
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is it acceptable to use "id" with any tag? For example, I've defined big in the stylesheets. So then will

    <big id="whatever">

    work with most browsers? Or should I start using span tags?

    Thanks, Phyllis

  • #15
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,785
    Thanks
    6
    Thanked 1,022 Times in 995 Posts
    <big> is no HTML tag/element. However, I think I've seen Firefox picking up styles on non-official elements. Anyway, you won't get far with it if it comes to cross browser compatibility.
    To answer your question: Yes, you can give any (HTML) element an ID but be aware that an ID is unique and can be used once on a page/document only.

    And you should assign IDs to elements you have already got in your HTML document and not define styles and then write the HTML for it.
    Last edited by VIPStephan; 01-29-2007 at 04:52 PM.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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