Reputation: 149
I would like to set an image as a brackground of every pages of my Ionic 2 app.
I know how to do that in the HTML or in the CSS of one page (which I could do in all of them).
I know how to set the background color of the whole app in theme\variables.scss
$background-color: map-get($map: $colors, $key: primary);
(for example)
But it seems like doing the same with
$background-image: url('assets/images/background-image.jpg');
does not work. Even if that exact same line in one page's css works.
.class-name-here{
background-image: url('assets/images/background-image.jpg');
}
Would it be possible to set an image as the whole app's default background in Ionic 2/ Ionic 3?
Upvotes: 2
Views: 2252
Reputation: 65988
You can set it as shown below:
Note: Need to use global scss
file. That is app.scss
app.scss
ion-content {
background-image: url('./assets/images/background-image.jpg');;
}
Upvotes: 5