Ionic v4 Change - Cannot set background-image of ion-content or ion-scroll
See original GitHub issueBug Report
Ionic Info
λ ionic info
cli packages: (C:\Users\julian\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 2.0.0-rc.6
ionic (Ionic CLI) : 4.0.0-rc.6
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@angular-devkit/core : 0.6.0
@angular-devkit/schematics : 0.6.0
@angular/cli : 6.0.1
@ionic/schematics-angular : 1.0.0-rc.6
Cordova Platforms : none
Ionic Framework : @ionic/angular 4.0.0-alpha.7
System:
NodeJS : v10.2.1
npm : 6.1.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Describe the Bug I cannot use background-image to set the background of the ion-content or ion-scroll.
Steps to Reproduce Steps to reproduce the behavior:
- Create new blank App
- use scss of the home page (home.page.scss) and add background-image code
Related Code At home.page.scss, none of the following is working
ion-content {
background-image: url('https://lorempixel.com/400/200/sports/Dummy-Text/');
background-repeat: no-repeat;
background-size: 100% 100%;
}
ion-scroll {
background-image: url('https://lorempixel.com/400/200/sports/Dummy-Text/');
background-repeat: no-repeat;
background-size: 100% 100%;
}
ion-content ion-scroll {
background-image: url('https://lorempixel.com/400/200/sports/Dummy-Text/');
}
But if I add the following at global.scss it will work
app-page-home {
ion-content ion-scroll {
background-image: url('https://lorempixel.com/400/200/sports/Dummy-Text/');
}
}
Expected Behavior I expect to be able to change the background image from the page’s scss file
Additional Context
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Ionic V4 beta 12: can't scale background image in ion-content
I've been unable to scale or otherwise alter a background image when used in an ionic-4 page. In the test.page.scss file, I put...
Read more >I Cannot set background image in ionic 4 div from template
If your goal is to set background image to the entire page, you could use --background for ion-content . Something like following has...
Read more >Ionic 4 background image not showing, Ion-img src not working ...
Ionic v4 Change,Ionic v4 Change - Cannot set background-image of ion-content or ion-scroll components as well, e.g. the button element within an ion-button....
Read more >Ionic 4: How to make a transparent header / toolbar? - Medium
Step 1: Add the fullscreen attribute to ion-content · Step 2: Make the toolbar transparent.
Read more >Background Images for Ionic 4 | Prototype A - WordPress.com
The background image will either shift or blank out for a moment. ezgif.com-video-to-gif. This is due to the fact that the ion-content component ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, its working as expected.
If the Ionic Team could confirm if this workaround is something that should always be used then I will close this issue.
I am going to close this since my above comment should resolve all outstanding issues here, and I have recently pushed a fix for #15635 which will be included in the
4.0.0-beta.12
release. If you are still seeing issues, please create a new issue. Thank you!