0

I have some div elements and I want to assign box-shadow attribute when hover on them.

<style>
    .hover-item :hover {
        box-shadow: 4px 4px 2px;

    }

</style>

But when i assign this class to them , their children <img /> and <h1></h1> get this attribute and when I hover them they will have shadow. I cant assign id to div elements because of some issues.

1 Answers1

1

If you're only wanting to add the shadow to the .hover-item, you need to take out the space, like this: .hover-item:hover. With the space (like you have it), CSS is interpreting it as you saying look inside .hover-item and find every :hover child element

Adam Johnston
  • 1,399
  • 2
  • 12
  • 23