基本形
親要素
子要素
#enc_1 .box.box1 .pairent .child {
color: red;
padding-left: 2em;
}
親要素
子要素
#enc_1 .box.box2 .pairent {
.child {
color: blue;
padding-left: 2em;
}
}
親クラスを配置する場所を明示的に示すためには&記号を使用する
sectionの下のh3
#enc_2 section {
&h3 {
font-weight: bold;
color: green;
}
}
文字は赤色です。
文字は青色です。
#enc_3 .square {
.red {
color: red;
}
.blue {
color: blue;
}
}
子要素の1番目
子要素の2番目
#enc_4 .enc {
.child_1, .child_2 {
font-size: 18px;
font-weight: bold;
}
.child_1 {
color: pink;
}
.child_2 {
color: green;
}
}