I am trying to execute a CSS transition (opacity:0
to opacity:1
with pleasant transition) - I'm writing Sass and using BEM.
I was hoping to make use of the sibling operator +
so that I can maintain my Sass nested BEM structure.
When the user hovers over .price__text
I want to set the opacity of it's sibling element .price__tooltip
to 1
Here is my SCSS as an example
.price {
&__text {
[...]
}
&__tooltip {
transition: all 0.2s ease-in;
opacity: 0;
[...]
&+ .price__text:hover {
opacity: 1;
}
}
}
I thought that the last selector in the SCSS, &+ .price__text:hover
would detect that when the sibling, .price__text
has as :hover
psuedo class it would make the current selected element .price__tooltip
have opacity:1
- but this doesn't seem to be correct.