0

I want to target the .drop class when I hover on the .categories class, it is possible to do this with css only?

enter image description here

3
  • 3
    Nope. Also, please provide your code as text and not as an image ;) Commented Dec 29, 2014 at 9:22
  • no possible with CSS use JS Commented Dec 29, 2014 at 9:25
  • possible duplicate of How to affect other elements when a div is hovered Commented Dec 29, 2014 at 9:26

1 Answer 1

3

div {
  width: 200px;
  height: 200px;
  float:left;
  margin: 10px;
  border: 1px solid #333;
}
.categories:hover ~ .drop {
  background-color: red;
}
<div class="categories">categories</div>
<div class="drop">drop</div>

I am afraid you can not target an element that is up to the DOM relatively to the hovered element only with CSS. You can achieve this with jQuery like so:

$('.categories').hover(function() {
    $('.drop').css({ // your code }) 
});

If the HTML was something like this check snippet:

<div class="categories"></div>
<div class="drop"></div>

you could do this:

.categories:hover ~ .drop {
    /* css rules */
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.