vrobik
vrobik

Reputation: 3

SCSS: use ampersand in pseudo class

   .my-class {
      &:before{
        content:"";
        display:block;
        background:red;
        h1 ????{
          padding-top: 5px
        }
      }
    }

is it possible to use & in this location to have output like

h1.my-class:before {
  padding-top: 5px
}

Upvotes: 0

Views: 233

Answers (1)

Sonia
Sonia

Reputation: 1919

You need to SCSS it this way::

.my-class {
  &:before {
    content: "";
    display: block;
    background: red;
    @at-root h1 {
      &.my-class {
        &:before {
          padding-top: 5px;
        }
      }
    }
  }
}

Upvotes: 1

Related Questions