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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:33:42+00:00 2026-05-27T19:33:42+00:00

On my last one, I asked how to make unfocusable elements become focus-able in

  • 0

On my last one, I asked how to make unfocusable elements become focus-able in the means of css selector. The answer is to use tabindex.

Now I wanted that, when an element with the selector is focused (clicked), the other element selected by the selector also got the effect. It may sound strange, but I could do that a long time ago accidentally, but I forgot how.

Here is the jsfiddle example :
http://jsfiddle.net/s4nji/xa8j4/

  • 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-27T19:33:43+00:00Added an answer on May 27, 2026 at 7:33 pm

    This selector does the trick:

    li[tabindex='1']:focus ~ li[tabindex='1'], li[tabindex='1']:focus {
        background: black;
        color: white;
    }
    

    Here‘s an example.

    It only selects both when you focus on the first one though.

    This only works in CSS3 since we’re using the general sibling selector.

    When the first one is focused, it selects the second one with the same tabindex and adds the background. The second li[tabindex='1']:focus is to apply the background to the currently focused one too.

    The general sibling selector can only select succeeding elements with the same parent. CSS can’t travel up the DOM, unfortunately. For this reason, the only way to have it work backwards too would be to use Javascript.

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

Sidebar

Related Questions

.NET 1.1 lacks ParameterizedThreadStart (I have to use 1.1 because it's the last one
As a follow up question to my last one , is there any simple
I'm starting up a new embedded system design using FreeRTOS. My last one used
Possible Duplicate: Last but one Char in vb.net String How do I find the
I did some timing tests and also read some articles like this one (last
I'm nearly done with a trackback system for my website, but have one last
Now with all the WaitOne and ManualResetEvent stuff working (thanks!) I've got one last
I did a lot of PHP programming in the last years and one thing
My last question was somewhat narrower than this one. I am interested to know
How might one retrieve the last element of a string array in visual basic

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.