scss 如何做SASS祖父母选择器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss 如何做SASS祖父母选择器相关的知识,希望对你有一定的参考价值。

.grid {
  $g: &;
  &__column {
    > div {
      #{$g}:hover & { 
// ...

// equals

.grid:hover .grid__column > div

// ("Caching" that first `&` can be very useful.)

///////////////////////
// Also useful when you're trying to do this...

.tooltip {
  &--center&--up {
    transform-origin: bottom center;
  }
}

// But you have to instead write it like this...

.tooltip {
  $t: &;
  &--center#{$t}--up {
    transform-origin: bottom center;
  }
}

以上是关于scss 如何做SASS祖父母选择器的主要内容,如果未能解决你的问题,请参考以下文章