&
is a shorthand notation meaning "the composed selector at this point". Which means
.div1 {
> ul.base {
> li {
&:hover > & {
...
... translates into:
|------- & --------| |------- & --------|
.div1 > ul.base > li:hover > .div1 > ul.base > li {
...
Also note &
is actually implicit most of the time. But, in fact, it's not &
which is implicit, but &
+
(space). That's why we use &:hover
- to specify we don't want the space between composed and :hover
.
Getting back to your request, you can't achieve what you want (modifying the sibling of the parent when the child is hovered). Not with CSS, nor with SCSS. It's only possible with JavaScript (because you can trigger anything from anywhere in JS). An that's because in CSS you don't have a parent selector. You can't go back on the selection chain from child to parent and then on to the parent's subsequent siblings.
See What do people mean when they say there's no parent selector? for a more in-depth explanation.
But you can modify the sibling of the parent when the parent is hovered (which is close enough):
.div {
ul.base {
&:hover + ul {
visibility: hidden;
}
}
}
Or, even better:
.div1 {
ul {
&.section {
transition: opacity .35s ease-in-out;
}
&.base:hover + ul {
opacity: 0;
}
}
}
Resulting in:
.div1 ul.section {
transition: opacity .35s ease-in-out;
}
.div1 ul.base:hover + ul {
opacity: 0;
}
<div class="div1">
<ul class="base">
<li>Hello World</li>
</ul>
<ul class="section">
<li>Goodbye World</li>
</ul>
</div>