E
E
eldgammel2021-01-04 21:08:24
Sass
eldgammel, 2021-01-04 21:08:24

@mixin not working in scss?

I can't figure out why the variables I pass in parentheses don't affect the size of the .button; From the mixin I get only the color

@mixin button-color ($height, $width) {

    @if (($height < $width) and ($width >= 35px)) {
        background-color: blue;    
    } @else {
        background-color: green;
    }
}

.button {
    @include button-color(100px, 200px); // работает только логика
}


5ff359fd00094284471080.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eldgammel, 2021-01-04
@eldgammel

Unfortunately, the comments could not answer
Below is the answer

@mixin button-color ($height, $width) {

    height: $height; // вот в чем соль
    width: $width;  // вот в чем соль

    @if (($height < $width) and ($width >= 35px)) {
        background-color: blue;    
    } @else {
        background-color: green;
    }
}

.button {
    @include button-color(100px, 200px); // работает только логика
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question