Code

Effect all siblings on mouse hover with CSS

When you over over a child class the other children's opacity is set to 10% using CSS. An easy way to utilize CSS vs Interactions to control children elements.

Effect all siblings on mouse hover with CSS preview

When you over over a child class the other children's opacity is set to 10% using CSS. An easy way to utilize CSS vs Interactions to control children elements.

How to add it

  1. Add CSS code snippet via an embed or added to your pages head section.
  2. Update class names if needed, this code uses class child

The code

CSS
                      <style>
.parent:hover > .child:not(:hover){
  opacity: 0.1;
}
</style>

                    
HTML
                      <div class="parent">
  <div class="child">first item</div>
  <div class="child">second item</div>
  <div class="child">third item</div>
  <div class="child">fourth item</div>
</div>

                    

Browse similar code snippets

Language

More from Corey Moen

Profile →

Related Webflow questions

All answers →

Similar code snippets

All code snippets →