Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6685721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:05:23+00:00 2026-05-26T05:05:23+00:00

In my HTML code I have a tag with a span tag inherited. My

  • 0

In my HTML code I have a tag with a span tag inherited. My question is now how can I achieve that the text in the link-element will be underlined on hover and the span-element not?

HTML:

<a class="tooltip" href="#">
  Link, should be underlined on hover.
  <span class="custom info">Span, shouldn't be underlined on hover.</span>
</a>

CSS:

/* General settings */

a { color: black; text-decoration: none }
a:visited { color: black; }
a:hover { color: #1af; text-decoration: underline }

/* End */

.tooltip {
    position: relative;
}

.tooltip span {
    display:none;
    position: absolute;
    white-space:nowrap;
    border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); 
    -webkit-box-shadow: 5px 5px rgba(0, 0,0, 0.1); 
    -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
    font-family: Calibri, Tahoma, Geneva, sans-serif;
    margin-left: 0; 
    z-index: 1;
    text-decoration: none;
}

a.tooltip:hover span {
    display:block;
    text-decoration: none;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:05:23+00:00Added an answer on May 26, 2026 at 5:05 am

    You could add another span (AKA HTML’s inline duct tape) and move the :hover styling to that:

    <a class="tooltip" href="#">
        <span class="hack">Link, should be underlined on hover.</span>
        <span class="custom info">Span, shouldn't be underlined on hover.</span>
    </a>
    

    And:

    a:hover span.hack { color: #1af; text-decoration: underline }
    /*...*/
    .tooltip span.info {
        /*...*/
        /* Remove text-decoration */
    }
    a.tooltip:hover span {
        display:block;
    }
    

    Demo: http://jsfiddle.net/ambiguous/UWgcc/1/

    You’d probably want to rename the hack class, I was just being honest with that.

    If you only want to mess around with your .tooltip links, then you could add this to the above:

    a:hover { color: #1af; text-decoration: underline }
    a.tooltip:hover { color: #000; text-decoration: none }
    

    Demo: http://jsfiddle.net/ambiguous/UWgcc/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my HTML code, I have a form tag that contains two input boxes,
I have a block of code that serializes a type into a Html tag.
I have html code as a string variable like a = <span> Spain will
I have a span tag in html and this <span> can appear multiple times
I have a span tag inside with there is some html code to create
i have following HTML code:- <table class=results> <tr> <td> <a href=..>link</a><span>2nd Mar 2011</span><br>XYZ Consultancy
I have the following html code: <font class=pricecolor colors_productprice> <span class=PageText_L483n> <font class=text colors_text>
I have this text file filled with some html code; <span>test</span><p>welcome</p> <span>Guest</span><p><img class=insertedImage src=/dynamictemplate/uploads/temp/167-5-IMG_0755.JPG
html code meta tag description, it is generated dynamically and we have quotes in
I have inherited some HTML code and have been asked to align the two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.