What is the meaning of the “@include” in .css Files?

后端 未结 1 569
别那么骄傲
别那么骄傲 2021-01-03 20:47

I don\'t understand , what is the meaning of the @include tag in .css files. For Example :

.wrapper {
display: flex;
width: 100%;
@include display(flex);
@in         


        
相关标签:
1条回答
  • 2021-01-03 21:09

    @includes are a part of SCSS, it's called Mixin. Here is an example:

    @mixin border-radius($radius) {
        -webkit-border-radius: $radius;
           -moz-border-radius: $radius;
            -ms-border-radius: $radius;
                border-radius: $radius;
    }
    
    .box { @include border-radius(10px); }
    

    @includes are a shortcut to storing especially things like vendor prefixes. The CSS output of the above will be:

    .box {
        -webkit-border-radius: 10px;
           -moz-border-radius: 10px;
            -ms-border-radius: 10px;
                border-radius: 10px;
    }
    
    0 讨论(0)
提交回复
热议问题