.scss不能填充,底部適用於內部span元素
div.playlist {
position: relative;
display: inline-block;
}
div.playlist span {
position: absolute;
text-align: center;
height: 100%;
width: 100%;
color: white;
font-size: 20px;
.span-icon {
padding-bottom: 50px !important;
}
}
div.playlist span:before {
display: inline-block;
vertical-align: middle;
height: 100%;
content: '';
}
的.html
<div class="playlist">
<span class="span-icon"><ion-icon name="ios-star-outline"></ion-icon></span>
<span>{{data.text}}</span>
<img [src]="data.imageUrl" [alt]="data.text" />
</div>
我需要給padding-bottom: 50px
只有第一span
元素(即class="span-icon"
)。我已經嘗試過如下。但它不起作用。你能告訴我問題在哪裏嗎?
div.playlist span {
position: absolute;
text-align: center;
height: 100%;
width: 100%;
color: white;
font-size: 20px;
.span-icon {
padding-bottom: 50px !important;
}
}
渲染的瀏覽器:
<ion-col class="col" col-6="">
<playlist ng-reflect-data="[object Object]"><div class="playlist">
<span class="span-icon"><ion-icon name="ios-star-outline" role="img" class="icon icon-md ion-ios-star-outline" aria-label="star outline" ng-reflect-name="ios-star-outline"></ion-icon></span>
<span>My Favorites</span>
<img src="./assets/images/img2.jpg" alt="My Favorites">
</div></playlist>
</ion-col>
是否正常的.span圖標嵌套在scss範圍內? – Mindless
對不起,我沒有得到你? 'span-icon'是我給出的一個自定義'類'。 @Mindless – Sampath
不在html裏面,但是scss,你有.span-icon在div.playlist裏面span – Mindless