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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:16:48+00:00 2026-06-11T16:16:48+00:00

I have a set of divs all with the same class (they don’t have

  • 0

I have a set of divs all with the same class (they don’t have to have the same class if it makes this easier). Ideally what I want is when a user hovers over one of these divs the other divs (with a background image in each) all turn grey to put focus on the currently hovered overed div. If it was the div being hovered over that was changing I would be fine, but I really have no idea how to tackle this. Some kind of sibling selector? I would prefer to just use css and am happy if the solution is not backwards compatible.

Here is my code so far. Thanks in advance!

.box:hover (SELECT ALL OTHER .BOX) {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-o-filter: grayscale(100%);
-ms-filter: grayscale(100%);
filter: grayscale(100%); }

edit: I realise I could give each box a different class, and then say when box 1 is hovered over, box 2,3,4 etc go grey, and do that for each.. but this seems like a lot of code for something simple.

  • 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-11T16:16:50+00:00Added an answer on June 11, 2026 at 4:16 pm

    The solution that follows will work only if your elements are adjacent, like a navigation bar. Maybe that’s not your situation, but it can help others. Must say that it is cross-browser CSS2.

    Wrap your <div> inside a container:

    <div class="container">
        <div class="target"></div>
        <div class="target"></div>
        <div class="target"></div>
        <div class="target"></div>
        <div class="target"></div>
    </div>
    

    And use it to control :hover

    .target {
        background-color: #444;
    }
    .container {
        float: left;
    }
    .container:hover .target {
        background: #bbb;
    }
    .container .target:hover {
        background: #444;
    }
    

    It’s working here

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

Sidebar

Related Questions

I have a set of divs which are specified under the same class name,
I have a number of divs with the same class, that I want to
I have the following function set up to sequentially fade in divs (with class
I have 1 div that will contain 3-5 divs with the same class. Below
I have a series of divs of the same class; some with title attributes
basically I have 4 images with divs set up like this: <div id=selector> <div
I have one issue with floating divs. I would like to set all divs
Hi all I have problem with my div's in html. I have set them
Doing some jquery animation. I have certain divs set up with an attribute of
I have a set of links and their corresponding divs showing information when clicked.

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.