I recently completed a project using Ionic 3
with a side menu
. I am now trying to implement a gradient background color for the entire side menu, but it's proving to be more challenging than expected. Any suggestions or ideas on how to achieve this?
app.html
<ion-menu [content]="content">
<ion-content class="background-gradient">
<ion-list no-lines>
<button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)" class="border-none" outline>
<ion-icon [name]="p.icon" item-left></ion-icon> {{p.title}}
</button>
</ion-list>
</ion-content>
</ion-menu>
app.component.ts
@Component({
templateUrl: 'app.html'
})
export class MyApp {
@ViewChild(Nav) nav: Nav;
rootPage: any = HomePage;
pages: Array<{ title: string, component: any, icon: string }>;
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
this.initializeApp();
// used for an example of ngFor and navigation
this.pages = [
{ title: 'Home', component: HomePage, icon: 'game-controller-b' },
{ title: 'Activity', component: '', icon: 'browsers' },
{ title: 'Contacts', component: '', icon: 'play' },
{ title: 'Add Project', component: '', icon: 'settings' },
{ title: 'Settings', component: '', icon: 'settings' }
];
}
app.scss
.background-gradient {
background: -webkit-linear-gradient(-55deg, #50a2a7 35%, #e9b44c 100%);
}
.border-none {
border: none;
}
Current appearance:
https://i.sstatic.net/5GbrD.png
Q: Can someone advise me on how to apply a gradient background color
to the menu items
within the side menu
? I've attempted various methods without success so far :(