Reputation: 2759
I'm getting an issue with ion-item background color.
What I want :
Set the background color to transparent.
What I have :
<ion-item class="custom-ion-toggle">
<ion-label>Remember me!</ion-label>
<ion-toggle formControlName="remember" slot="start" color="secondary" mode="ios"></ion-toggle>
</ion-item>
This generate a <div class="item-native">
with a white background.
What I've tried to do :
app.component.scss :
.item-native {
background: transparent !important;
}
So this is what I get :
Upvotes: 3
Views: 2931
Reputation: 75
I had the same problem, I just set the property color to "undefined" in the ion-item tag and it works, give it a try. (Also I set lines to none in ion-list to remove lines at the bottom of each item)
<ion-list lines="none">
<ion-item color="undefined">
<ion-avatar slot="start">
<img [src]="student.photo" />
</ion-avatar>
<ion-label>
<p>{{student.name}}</p>
</ion-label>
</ion-item>
</ion-list>
Upvotes: 0
Reputation: 1407
In Ionic 6:
Set color property to item:
<ion-item color="primary">
In global.scss override the color:
ion-item {
--ion-color-primary: transparent;
}
Upvotes: 0
Reputation: 93
Use this on your css style:
ion-item {
--background: transparent !important;
}
Upvotes: 0
Reputation: 41
try this in your css page :
ion-item {
--ion-background-color: transparent !important
}
Upvotes: 4
Reputation: 1226
Use the ion-item CSS custom property supplied by Ionic:
.custom-ion-toggle {
--background-color: transparent;
}
Upvotes: 0
Reputation: 1616
try this in login.scss
.custom-ion-toggle{
background-color: transparent !important;
}
i have tried it in my app and it's working completely fine.
Upvotes: 0