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 8748367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:30:48+00:00 2026-06-13T12:30:48+00:00

I am attempting to create a simple 3d effect on my nav buttons using

  • 0

I am attempting to create a simple 3d effect on my nav buttons using border colors. My buttons are simply comprised of an unordered list with background color, border colors, and text padding, and of course links, so the links are nested in the typical way like so:

<ul>
<li><a class="active"   href="link1.html">link1</a></li>
<li><a class="inactive" href="link2.html">link2</a></li>
<li><a class="inactive" href="link3.html">link3</a></li>
..etc
</ul>

I am using jquery to change the anchor classes on click to change their look.

What I would like to do is use css (or even jquery I guess) to specifically target the anchor that follows the ‘active’ link, but I’m not sure if it’s possible.

I’ve tested the use of the ” h3 + p { ” type of selector and I understand how that works, but it seems to stop functioning as soon as I try to target links.

I’ve tried:

a.active + a {background-color:red}

and…

a.active:link + a:link {background-color:red}

and other variants of specificity…

li a.active:link + a:link {background-color:red}

ul li a.active:link + a:link {background-color:red}

ul li a.active:link + a.inactive:link {background-color:red}

…etc.

This obviously works:

p.active + p {background-color:red}

… so why doesn’t this?

a.active + a {background-color:red}

So basically I’m trying to figure out why I can’t get the sibling combinator to work with links, and if there’s a solution or workaround.

  • 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-13T12:30:49+00:00Added an answer on June 13, 2026 at 12:30 pm

    You are using Adjacent sibling combinator, as your anchor links are not siblings your selector doesn’t select the element.

    E + F: an F element immediately preceded by an E element

    As you are using jQuery you can select the element this way:

    $('a.active').parent().next().children('a').addClass('red')
    

    http://www.w3.org/TR/selectors/#adjacent-sibling-combinators

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

Sidebar

Related Questions

I am attempting to create a simple application using Eclipse GEF that displays a
I am attempting to create a simple tracker using php and google maps. Right
Im attempting to create a simple list out of some elements I stole from
I am attempting to create a simple java form using Swing. The idea basic
I'm attempting to create a linked list of length n using Python. I have
I'm attempting to create a simple DSL to handle reasonably complex dice-rolling instructions using
I'm using Doctrine2+CodeIgniter2, and am attempting to create a simple test of a join
I am attempting to create a simple program that will keep a text log
I am attempting to create a simple abacus for a beginner's programming course, and
I am attempting to create and host a simple RESTful WCF Service. The service

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.