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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:27:27+00:00 2026-06-17T06:27:27+00:00

<div> <div class=header> <div id=navbar > <ul id=nav> <li><a id=trigger><span><p></p></span></a></li> <li><a id=target><span><p></p></span></a></li> </ul> </div>

  • 0
<div>
  <div class="header">
    <div id="navbar" >
      <ul id="nav">
        <li><a id="trigger"><span><p></p></span></a></li>
        <li><a id="target"><span><p></p></span></a></li>
      </ul>
    </div>
  </div>
</div>

hey guys, I’ve got a question, if it wouldn’t causing any inconvenience to you guys, in relation with traversing in HTML tree.

I already know how to choose the <a id="trigger"></a> with this syntax:

div>div.header>div#navbar>ul#nav>li>a#trigger:hover {CSS} will trigger changes.

But here’s the problem, I wanted to target the <a id="target""></a> tag underneath it but I haven’t found the right syntax for accessing the <a id="affected"></a> there.

I want when I hover the id=”trigger”, the id=”target” will be affected.

I’ve already tried using + selectors to target that id, alas, the trials ended in vain.

Is it possible to affect that id?

  • 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-17T06:27:28+00:00Added an answer on June 17, 2026 at 6:27 am

    You probably want the adjacent sibling selector:

    #trigger:hover + #target {}
    

    Or maybe the sibling combinator, which doesn’t require that the second element be directly adjacent:

    #trigger:hover ~ #target {}
    

    http://css-tricks.com/child-and-sibling-selectors

    UPDATE: As is stated in the comments below, the selectors must actually be siblings. In the original structure, they’re not.

    <div>
      <div class="header">
        <div id="navbar" >
          <ul id="nav">
            <li class="one"><a id="trigger">Trigger</a></li>
            <li class="two"><a id="target">Target</a></li>
          </ul>
        </div>
      </div>
    </div>
    
    .one:hover + .two {color: red}
    

    http://jsfiddle.net/5Gmz9/1/

    Here’s another approach which doesn’t require classes or IDs on the li elements:

    #nav li:first-child:hover + li {color: red}
    

    http://jsfiddle.net/5Gmz9/2/

    Each approach has its pitfalls.


    By the way,

    div>div.header>div#navbar>ul#nav>li>a#trigger:hover {}
    

    could probably be as well written as

    #navbar #trigger:hover {}
    

    saving you and the browser both some work.

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

Sidebar

Related Questions

_header.html.erb <header class=navbar navbar-fixed-top> <div class=navbar-inner> <div class=container> <%= link_to sample app, root_path, id:
I have this HTML: <header> <div class=navbar navbar-fixed-top> <div class=navbar-inner> <div class=container> <a class=btn
My navbar code looks like this: %header.navbar.navbar-fixed-top %div.navbar-inner %div.container %nav %ul.nav.pull-right - if user_signed_in?
My div with class name 'header-body-right' doesn't seem to be floating to the left
'<div id="'+div_id+'" class="widget" style="height:60px;width:110px">\n\ <div class="widget-head ui-widget-header" style="cursor:move;height:20px;width:130px">'+ '<span id="'+span_id+'" style="float:right; cursor:pointer" class="dialog_link ui-icon
<div class=header> <div class=contact half> <dl> <dt>Email</dt> <dd>z@srgbethet.com</dt> <dt>Phone</dt> <dd>+456 333 444</dd> <dt>Website</dt> <dd>kkkk.com</dd>
I have the following output: <section class=group> <div class=header>Header 1</div> <div class=item>item1</div> <div class=item>item2</div>
I have this html: <div class=portlet-header> Company Information ... <button> some button here </button>
I have the following jquery code: $(document).ready(function() { $(body[class*=page-calendar-practices] #content-header h1#title).after(<div id='athletics_practice-schedule'><div id='inner-title'><a href='www.example.com'
I have a div class named switch control which has a div class named

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.