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

  • SEARCH
  • Home
  • 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 9260403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:52:59+00:00 2026-06-18T12:52:59+00:00

I have an <a> with a <span> children. I have written some CSS which

  • 0

I have an <a> with a <span> children. I have written some CSS which changes the border-color of the children when the parent is hovered, but it also changes the border-color when I hover the children, which it shouldn’t.

a {
    padding: 50px;
    border: 1px solid black;
}

a span {
    position: absolute;
    top: 200px;
    padding: 30px;
    border: 10px solid green;
}

a:hover span {
    border: 10px solid red;
}   
<a>
    Parent text
    <span>Child text</span>    
</a>
  • 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-06-18T12:53:00+00:00Added an answer on June 18, 2026 at 12:53 pm

    Update

    The below made sense for 2013. However, now, I would use the :not() selector as described below.


    CSS can be overwritten.

    DEMO: http://jsfiddle.net/persianturtle/J4SUb/

    Use this:

    .parent {
      padding: 50px;
      border: 1px solid black;
    }
    
    .parent span {
      position: absolute;
      top: 200px;
      padding: 30px;
      border: 10px solid green;
    }
    
    .parent:hover span {
      border: 10px solid red;
    }
    
    .parent span:hover {
      border: 10px solid green;
    }
    <a class="parent">
        Parent text
        <span>Child text</span>    
    </a>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code $(this).parent().children('.vote_count').children('span.number') but I am wondering if there is a better
I have the following: a = li.parent().parent().children('a, span'); I have a loop set up
I have one input field and one division with span children <input type=text id=input
I have a div and its children span . I attached an event with
I have a span that is generated through javascript, with its css class as
I want to have multiple span.play without IDs which can be clicked and play
I have one large rectangular parent div inside which there are many child divs.
I have some htmls, where some tags does not have any children, and I
i have a selection of (2) elements, selected by this: $(this).parents(tr:first).children(td).children(span); when i do
I have some html code having hierarchy as <div id=a> <span> <span id=s1>...</span> <span

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.