I am trying to create a simple layout in angular 2 using angular material and flex css..
Below is my code...
<div class="background" >
<mat-toolbar fxLayout="row" fxLayoutAlign="space-between none" >
<div fxLayout="column" >
<p>SPACE STUDY</p>
<h6>Rockefeller FY 2018</h6>
<div fxShow="true" fxHide.gt-sm="true" fxLayout="column" fxLayoutAlign="start none">
<h6 [matMenuTriggerFor]="dashboarditems">
<mat-icon style="transform: scale(1.2);">line_weight</mat-icon> </h6>
<mat-menu class="mat-menu-panel" [overlapTrigger]="true" #dashboarditems="matMenu"><br/><br/>
<a routerLink='/home' routerLinkActive='active'>
<span matTooltip="HOME"><mat-icon style="color:lightgreen;">home</mat-icon></span></a><br/><br/><br/>
<a >
<span matTooltip="SPACE SURVEY"><mat-icon style="color:deeppink;">explore</mat-icon></span></a><br/><br/><br/>
<a >
<span matTooltip="SPACE ADMIN"><mat-icon style="color:lightblue;">account_circle</mat-icon></span></a><br/><br/><br/>
<a >
<span matTooltip="REPORTS"><mat-icon style="color: orange;">assignment</mat-icon></span></a><br/><br/><br/>
<a >
<span matTooltip="JOINT USE"><mat-icon style="color:yellow;">supervisor_account</mat-icon></span></a><br/><br/><br/>
<a >
<span matTooltip="HELP"><mat-icon style="color:red;">help</mat-icon></span></a><br/><br/><br/>
</mat-menu>
</div>
</div>
<div fxLayout="row" fxShow="true" fxHide.lt-md="true" >
<button mat-raised-button routerLink='/home' routerLinkActive='active'>
<span matTooltip="HOME"><mat-icon style="color:lightgreen;">home</mat-icon></span></button>
<button mat-raised-button >
<span matTooltip="SPACE SURVEY"><mat-icon style="color:deeppink;">explore</mat-icon></span></button>
<button mat-raised-button >
<span matTooltip="SPACE ADMIN"><mat-icon style="color:lightblue;">account_circle</mat-icon></span></button>
<button mat-raised-button >
<span matTooltip="REPORTS"><mat-icon style="color: orange;">assignment</mat-icon></span></button>
<button mat-raised-button >
<span matTooltip="JOINT USE"><mat-icon style="color:yellow;">supervisor_account</mat-icon></span></button>
<button mat-raised-button >
<span matTooltip="HELP"><mat-icon style="color:red;">help</mat-icon></span></button>
</div>
</mat-toolbar>
</div>
<style>
.background {
/* Remember to use the other versions for IE 10 and older browsers! */
display: flex;
min-height: 100%;
font-family: 'verdana', sans-serif;
color: #fff;
height:100vh;
background: #222222;
background: #16222A; /* fallback for old browsers */
background: -webkit-linear-gradient(to top, #16222A , #3A6073); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to top, #16222A , #3A6073); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
p{
font-size:20px;
font-weight:bold;
font-family: 'verdana', sans-serif;
margin:3px;
}
h6{
font-size:12px;
font-weight:bold;
font-family: 'verdana', sans-serif;
}
.mat-raised-button{
text-align:left;
border-radius:10px;
font-size:11px;
font-weight:bold;
font-family: 'verdana', sans-serif;
color:white;
background:transparent;
}
.mat-icon {
transform: scale(1.5);
}
.matTooltip{
font-size:11px;
font-weight:bold;
font-family: 'verdana', sans-serif;
}
.mat-menu-panel {
min-width: 35px;
max-width: 280px;
overflow: auto;
-webkit-overflow-scrolling: touch;
max-height: calc(100vh - 48px);
border-radius: 2px;
outline: 0;
background: transparent;
padding-left: 10px;
}
</style>
This is my output
Here I am trying to change the background color for the mat-menu container to transparent and also set some other styles.
When i change in console its getting reflected back as shown below
But when i applied the same changes in my code , the styles are not being applied.
I also tries explicitly adding class="mat-menu-panel" in the component and the div in which i added the mat-menu.
But still the styles are not being applied..
can anybody please help me to fix this styling..
please access my sample code here.. https://stackblitz.com/edit/angular-mat-formfield-flex-layout-vc3fsj?file=app%2Fapp.component.html
style.scss
file you already put rules for body, try adding the mat-menu styles there. A good resource to check out is this one blog.thoughtram.io/angular/2017/05/23/… – arsanyf