SASS ရှိ ကိန်းရှင်များနှင့် အကြောင်းအရာ ဘလော့ခ်များ၏ မြင်ကွင်းနယ်ပယ်
မစ်ဇင်သို့ အကြောင်းအရာ ဘလော့ခ်များ ပေးပို့သည့်အခါ၊ ၎င်းတို့၏ မြင်ကွင်းနယ်ပယ်ကို မစ်ဇင်၏ တည်နေရာအပေါ် မဟုတ်ဘဲ ဘလော့ခ်၏ တိကျသော တည်နေရာအပေါ် မူတည်၍ သတ်မှတ်ပါသည်။ ထို့ကြောင့်၊ ကျွန်ုပ်တို့သည် ပေးပို့ထားသော အကြောင်းအရာ ဘလော့ခ်ထဲတွင် မစ်ဇင်၏ ဒေသခံ ကိန်းရှင်များကို အသုံးပြု၍မရနိုင်ပါ။ အဆိုပါဘလော့ခ်သည် ကမ္ဘာလုံးဆိုင်ရာ ကိန်းရှင်များနှင့်သာ အလုပ်လုပ်နိုင်မည်ဖြစ်သည်။
အောက်ပါ ဥပမာကို သုံးသပ်ကြည့်ပါမည်။
styles.scss$size: 14px;
@mixin sizes ($size: 20px) {
font-size: $size;
padding: $size;
@content;
}
.navbar {
@include sizes {
margin: $size;
}
}
စုစည်းပြီးရလဒ်။
styles.css.navbar {
font-size: 20px;
padding: 20px;
margin: 14px;
}
Задание 1
အောက်ပါကုဒ်၏ စုစည်းပြီးရလဒ်သည် မည်သို့ဖြစ်မည်ကို ပြောပြပါ။
styles.scss$color: yellow;
@mixin links ($color: red) {
background: $color;
@content;
}
Задание 2
အောက်ပါကုဒ်၏ စုစည်းပြီးရလဒ်သည် မည်သို့ဖြစ်မည်ကို ပြောပြပါ။
styles.scss$color: yellow;
$size: 10px;
@mixin links ($color: red, $size: 12px) {
background-color: $color;
font-size: $size;
@content;
}
.navbar {
@include links {
box-shadow: $color;
padding: $size;
}
}
Задание 3
အောက်ပါကုဒ်၏ စုစည်းပြီးရလဒ်သည် မည်သို့ဖြစ်မည်ကို ပြောပြပါ။
styles.scss$color: green;
$size: 6px;
@mixin links ($color: red, $size: 10px) {
color: $color;
font-size: $size;
@content;
}
.navbar {
@include links {
border-color: $color;
margin: $size;
}
}
#active{
@include links{
background-color: $color;
padding-top: $size;
padding-bottom: $size * 2;
}
}