SASS ရှိ @at-root ညွှန်ကြားချက်
@at-root ညွှန်ကြားချက်သည်
မိဘ selector မှ စည်းမျဉ်းများကို
ဖိုင်အမြစ်သို့ ထုတ်ယူရန်အတွက် ရည်ရွယ်ပါသည်။
ပထမအဆင့် ထပ်တွင်း selectors များဖြင့် အောက်ပါ ဥပမာကို ကြည့်ရအောင်။
.parent {
background-color: #fdd;
@at-root .child {
border: 1px solid;
}
}
အပြောင်းအလဲ ပြုလုပ်ပြီးနောက် ကျွန်ုပ်တို့ရရှိသော ကုဒ်သည် အောက်ပါအတိုင်းဖြစ်သည်။
.parent {
background-color: #fdd;
}
.child {
border: 1px solid;
}
ယခု selectors များစွာဖြင့်
@at-root ညွှန်ကြားချက်၏
လုပ်ဆောင်ချက်ကို ကြည့်ရအောင်။
.main-parent {
background-color: #fdd;
@at-root {
.first-child {
border: 1px solid;
}
.second-child {
font-weight: bold;
}
}
.step-child {
color: #232523;
}
}
အပြောင်းအလဲ ပြုလုပ်ပြီးနောက် ကုဒ်သည် အောက်ပါအတိုင်း ပေါ်လာပါသည်။
.main-parent {
background-color: #fdd;
}
.first-child {
border: 1px solid;
}
.second-child {
font-weight: bold;
}
.main-parent .step-child {
color: #232523;
}
အောက်ပါကုဒ်၏ အပြောင်းအလဲ ရလဒ်သည် ဘာဖြစ်မည်ကို ပြောပြပါ။
.primary-button {
background-color: #3272c7;
@at-root {
.block-button {
color: #ff0000;
}
.content-button {
color: #ccb42a;
}
}
.warning-button {
border: 2px solid #232523;
}
}