F
F
focusss2021-03-12 23:55:41
Sass
focusss, 2021-03-12 23:55:41

Why are properties not applied in SCSS?

There is an element and a pseudo-class. If the element has an active class, then the pseudo-element needs to be slightly rotated. But for some reason the rules don't apply. Where do I spit?

&-head {
    position: relative;
    padding: 28px 0;
    font-size: 24px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;

    &::before {
        content: '';
        position: absolute;
        top: 50%;
        -webkit-transform: translateY(-50%);
        transform: translateY(-50%);
        right: 10px;
        width: 30px;
        height: 30px;
        background: url(/build/image/x.svg) 0 0 no-repeat;
        background-size: cover;
    }

    &.active &::before {
        transform: translateY(-50%) rotate(45deg);
        background-color: red;
    }
}


If I try &.active span {свойства}, then the rules take effect on the span, but not on the pseudo-element. It also does not affect the element itself, if you do &.active & {свойства}.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2021-03-13
@focusss

I am surprised by such questions. Are you too lazy to look at the compiled css to find your mistake?
owhgsDic.jpg?download=1&name=%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%2013-03-2021%2000:02 :38.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question