angular-material2 toolbar shadow

余生长醉 提交于 2019-12-22 01:53:35

问题


I am new to material2 I am trying to keep the the main app toolbar fixed on the top of the screen the problem is that the elevation is not working correctly (the content hides the drop shadow of the toolbar) I Here is my HTML code

.app-content {
  height: calc(100% - 64px);
  overflow: auto;
}
<md-toolbar class="mat-elevation-z5" color="primary" style="z-index: 100!important;">

  <button md-icon-button (click)="start.open()">
      <md-icon class="demo-toolbar-icon">menu</md-icon>
    </button>
  <span>E-Learning</span>

  <span class="demo-fill-remaining"></span>
</md-toolbar>
<div class="app-content" style="z-index: 0!important;">
  <div class="workspace">
    <el-teacher></el-teacher>
  </div>
</div>


回答1:


You have to provided position relative/absolute/fixed/static to your element to get z-index working.

.mat-elevation-z5 {
   position: relative;
   z-index: 2;
}


来源:https://stackoverflow.com/questions/42415537/angular-material2-toolbar-shadow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!