hello team ,
I create ionic 4 project first time and want to set a background image to ion-content then I set it in class as
background: url("…/assets/imgs/home-bg.png"); but It gives error not work
Use --background
instead of background
. e.g.
ion-content {
--background: url("…/assets/imgs/home-bg.png")
}
What’s happening is that there is a shadow DOM element that is generated and it is using the --background
variable to set it’s background. Setting background
on the ion-content
element won’t actually put the rule on the element being displayed.
1 Like
thnx for replay, its work