s.k.
s.k.

Reputation: 1

ionic4 background image/color is not show up

I'm trying to set a background image or background color but it does not appear Background image - There is an error on the url Background color - no error appears but no background appears either ...

scss:

:host{
    ion-content.bg-image{
        background: url('assets/homebackround.jpg') no-repeat 100% 100%;
    }
}
html:

<ion-header>
  <ion-toolbar>
    <ion-title>
      ionic4
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content class="bg-image" no-scroll padding>
  
</ion-content>

the result

Upvotes: 0

Views: 289

Answers (1)

Varun Sukheja
Varun Sukheja

Reputation: 6548

You can directly use the css property given by Ionic4 and here is how you can use it.

ion-content{
    --background: url('assets/homebackround.jpg') no-repeat 100% 100%;
}

Here is running code in stackblitz

Upvotes: 1

Related Questions