When I inspect the element in Chrome I get the display: block;
but background-size: cover;
is nowhere.
Do you have an idea what could cause this?
This is my code:
<div class="image-slides" [ngStyle]="{'background': 'linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url(' + (items | async)?.img_paths[0]+ ') center center no-repeat','display': 'block', 'background-size': 'cover'}">
<ion-icon class="back-icon" (click)="goBack()" color="light" name="ios-arrow-round-back"></ion-icon>
<ion-icon class="fav-icon" color="light" name="star"></ion-icon>
<h1>Hello {{(items | async)?.name}}</h1>
</div>
您应该像这样在url(' + (items | async)?.img_paths[0]+ ')
:
[ngStyle]="{'background': 'linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url(\' + (items | async)?.img_paths[0]+ \') center center no-repeat','display': 'block', 'background-size': 'cover'}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.