-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ionic v4 Change - Cannot set background-image of ion-content or ion-scroll #14530
Comments
Pinned it down to the following problem: The generated ion-scroll element does not get the A workaround is described here https://stackoverflow.com/questions/36265026/angular-2-innerhtml-styling thus you can use |
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. |
Thanks, I was facing same product |
I would be wary of anything with https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep
I would imagine that the Ionic Team will not build on deprecated features of any of the frameworks that will be supported in the 4.0.0 release, and thus, I would not include them in any application using v4, @dmastag + @UncertaintyP... |
Thanks @MT-- Josh Morony is suggesting to use Ref: https://www.joshmorony.com/my-method-for-upgrading-from-ionic-3-to-ionic-4/ |
Thanks for the issue! We do currently recommend setting If you do want to use Angular's default @Component({
selector: 'page-tutorial',
templateUrl: 'tutorial.html',
styleUrls: ['./tutorial.scss'],
- encapsulation: ViewEncapsulation.None
}) It will result in the following (broken) look: However, if I change the CSS to target - page-tutorial {
+ :host {
ion-toolbar { Everything looks good again: For the original issue, you should be able to do the following using latest: :host {
ion-content {
--background: url('https://lorempixel.com/400/200/sports/Dummy-Text/') no-repeat 100% 100%;
}
} If you are trying to do a fullscreen background and notice that the image isn't going up behind the header, there's an issue for that here: #15635 I hope that clears it up, but please let me know if you have questions! Thanks! |
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 |
in your post above... the line:
doesn't seem to change the size of the image when 100% is changed for either width or heighth. (however no-repeat and repeat are working correctly.) Is this coming out in a future fix? |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Bug Report
Ionic Info
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:
Related Code
At home.page.scss, none of the following is working
But if I add the following at global.scss it will work
Expected Behavior
I expect to be able to change the background image from the page's scss file
Additional Context
The text was updated successfully, but these errors were encountered: