首页 > 解决方案 > Angular Material中的模态布局响应

问题描述

我对在 Angular Material 中使用模态的响应性有疑问。我怎样才能让它在小屏幕上看起来不错。它不必是 mat-grid

请看这个stackblitz链接

点击这里

  openDialog() {
    const dialogRef = this.dialog.open(ModalComponent, {
      width: "650px",
      height: "380px"
    });
  }

标签: cssangularangular-materialangular8angular-flex-layout

解决方案


Demo你可以在 style.css 中使用媒体查询

 @media only screen and (max-width: 700px) {
  .modal .mat-grid-tile {
     width:100% !important;
     position:relative!important;  
     left:0 !important; 
  }
  .modal .mat-form-field {
    width: 100%
  }
  .modal .mat-radio-button {
    padding: 10px;
  }
  .modal .mat-raised-button.mat-warn {
       margin:5px
   }
}

推荐阅读