Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49526

Ionic 4 : Cannot Set Background Image

$
0
0

@junjunhernandez wrote:

Hello there,

I am trying to change the background image of ion-content but cannot make it work.
I did:

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

The above somehow works ONLY IF I UNCHECK the styling of :host using Google Chrome’s console.
There is always a layer that has a white background in front of the ion-content, that is why the background image does not show and the only thing I can see is the white background of :host.

So I tried:

.inner-scroll {
	background-image: url('/assets/app_images/school.png') !important;
}

and

.scroll-y {
	background-image: url('/assets/app_images/school.png') !important;
}

but the result is still the same…

Before unchecking the background of :host

I found out that its there after unchecking the background of :host

background1

background3

I also added encapsulation:

ViewEncapsulation.None

on my component but it doesn’t seem to help. No effect at all.

How can I make the background show?

I have developed mobile apps using Ionic 3 with so much ease but its pain using Ionic 4.
I actually wasted 7 hours of searching on forums as well as trial and error with no success for just a simple background image. :tired_face: TIA. :slight_smile:

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49526

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>