모든 하위 요소를 상위 요소에 중첩하는 것이 필수입니까? 제 예제 코드를 살펴보십시오. 나는 몇몇 기사를 보았고, 어린이 요소를 4 단계로만 중첩 시키라고 경고했다. 하지만 여기에 나는 모든 아이를 그것의 부모로 감쌌다. 이 형식과 같은 sass를 코딩해도 괜찮습니까?SASS 중첩 우수 사례?
<div class="col-md-3 left-side">
<div class="profile-info">
<img src="img/user.jpg" alt="">
<div class="info">
<p>Header</p>
<span>2 minutes ago</span>
</div>
</div>
<div class="ads">
<h4>Advertisements</h4>
<img src="img/ad1.jpg" alt="">
<p>Grab your book !!!</p>
<img src="img/ad2.jpg" alt="">
<p>Hurry up. Limited offers !!!</p>
<img src="img/ad3.jpg" alt="">
<p>Grab your book !!!</p>
<img src="img/ad4.jpg" alt="">
<p>Hurry up. Limited offers !!!</p>
</div>
</div>
.left-sidebar{
height: auto;
background-color: #fff;
.ads{
img{
width:100%;
}
h4{
margin-top:45px;
margin-top: 45px;
font-weight: 600;
}
p{
margin-top: 5px;
font-weight: 500;
margin-bottom: 22px;
}
}
.profile-info{
@include basic_style;
padding-top: 31px;
.info{
padding-top: 28px;
padding-left: 16px;
display: inline-block;
@media only screen and (max-width: 1200px){
padding-top: 20px;
padding-left: 0px;
text-align: center;
display: block;
}
}
img{
width: 100px;
height: 100px;
border-radius: 50%;
float: left;
@media only screen and (max-width: 440px){
width: 85px;
height: 85px;
}
@media only screen and (max-width: 1200px){
display: block;
margin: 0 auto;
float: none;
}
}
p{
@include post_title;
}
span{
@include sub_header;
}
}
}