Angular -ng-bootstrap-NgbModal弹出窗口类属性不起作用

at0kjp5o  于 2022-12-07  发布在  Bootstrap
关注(0)|答案(1)|浏览(143)

我有一个模态弹出窗口,我想增加它的宽度。
这是Angular 编码

openTaskDetails(content) {
const options : NgbModalOptions={
  size : 'lg',
  windowClass :'mycustomClass'
}
this.modalService.open(content ,options).result.then((result) => {
  this.saveTask(result);
}, (reason) => {
  console.log(reason);
});
}

并且CSS被

.mycustomClass .modal-lg {
      width : 80% !important;
      max-width: 90% !important;
      background-color:red;
}

size属性工作正常,但windowClass不正常。我试过了

.mycustomClass {
       width : 80% !important;
       max-width: 90% !important;
       background-color:red;
}

但是仍然存在同样的问题,弹出窗口的宽度没有增加。
当我检查元素时,我看到类名称mycustomClass插入到HTML中,但找不到css。

相关问题