Sass scss中悬停的子选择器
所以我有这个html代码Sass scss中悬停的子选择器,sass,bem,Sass,Bem,所以我有这个html代码 <aside class="sidebar"> <div class="sidebar__logo">....</div> .... </aside> 这很好,但不是边界元法 我怎么能把它改成这样 .sidebar { width:100px; &__logo{ width : 40px; & hovere
<aside class="sidebar">
<div class="sidebar__logo">....</div>
....
</aside>
这很好,但不是边界元法
我怎么能把它改成这样
.sidebar {
width:100px;
&__logo{
width : 40px;
& hovered over the parent {
width : 80px
}
}
&:hover {
width:200px;
}
}
您可以使用
$self
缓存当前选择器(&),然后使用{$self}\uuuu徽标访问.sidebar\uuu徽标
。更多信息:
.sidebar {
width:100px;
&__logo{
width : 40px;
& hovered over the parent {
width : 80px
}
}
&:hover {
width:200px;
}
}