I am guessing that this ion-backdrop
question it's related with the Ionic Alert Controller. If that is the case than you need to apply CSS inside the global.scss
(Ionic 3) file or theme\variable.scss
(Ionic 4/5). This is required because ion-backdrop
lives in the app as an Ionic Global Component.
Therefore find the mentioned file inside your Ionic project. It's usually in this directory app > src > global.scss.
Now let's suppose that we have this Alert Controller instanciated in some page class.
...
async serviceErrorAlert() {
const alert = await this.alertController.create({
cssClass: 'try-again-alert',
...
});
await alert.present();
}
...
As you can see this Alert Controller haves a CSS class of try-again-alert
.
So to add all custom CSS that you want just go the style file and add your own style.
global.scss
(Ionic 3):
.try-again-alert {
--background: rgba(55, 67, 77, 0.9);
}
theme\variable.scss
(Ionic 4/5):
I strongly recommend you to use CSS background
attribute and rgba()
property. With this approach you can now choose the color that you want (first three numbers) and the opacity of the color (fourth number).