Ionic4 - Setting background-image not showing

Hello there,

I am trying to change the background image of ion-content page but cannot.

I am using ionic4 version4.10.3

i have tried in the page scss:

ion-content {
    --background: url('/assets/img/background.jpg') no-repeat center center fixed;
}

and

ion-content {
	background-image: url('/assets/img/image.png') !important;
}

both have not worked.
The page still loads with a white background

Any help will appreciated!.

See: https://chrisgriffith.wordpress.com/2019/03/02/background-images-for-ionic-4/

Note , the path to the asset is relative to the page’s directory.

ion-content {
  --background: url(../../assets/bg.jpg) no-repeat center/cover fixed;
}
1 Like

Works like a charm !

Thank You!