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.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    <span> inside <a> - broken underline hover (IE)

    The following code (which you can copy and paste as a complete file) works in Gecko browsers and Opera, but not IE.
    What I'm trying to achieve is a single hyperlink for which some text underlines when hovered over, but the rest of the text does not (despite being part of the hyperlink). Does anyone know how this can this be achieved in Internet Explorer?

    <html>
    <head>
    <style>
    a {
    text-decoration: none;
    }
    a:hover .test2 {
    text-decoration: underline;
    }
    </style>
    </head>
    <body>
    <a href="#"><span class="test2">One</span> Two</a>
    </body>
    </html>

    Many thanks in advance for any help or ideas you can provide.

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Code:
    <html>
    <head>
    <style>
    a {
    text-decoration: none;
    }
    
    a:hover {
    text-decoration: underline;
    }
    a:hover .test2 {
    text-decoration: none;
    }
    </style>
    </head>
    <body>
    <a href="#">One <span class="test2">Two</span></a>
    </body>
    </html>

  • #3
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Kurashu!


  •  

    Posting Permissions

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