我正在尝试使用将 ngbmodal 对话框的背景颜色更改为蓝色蓝色。它不起作用,为什么?
我的代码是:
* 组件调用:
let options: NgbModalOptions = {
size: 'sm',
backdrop:'static',
backdropClass: "light-blue-backdrop"
};
var res = this.modalService.open(content, options);
*html 组件:
<ng-template #content let-modal>
<div class="modal-header">
<h4 class="modal-title">Modal title</h4>
<button type="button" class="close" aria-label="Close" (click)="modal.dismiss('Cross click')">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" (click)="modal.close('Close click')">Close</button>
</div>
</ng-template>
* CSS类:
.dark-modal .modal-content {
background-color: red;
color: white;
}
.dark-modal .close {
color: white;
}
.light-blue-backdrop {
background-color: blue !important;
}
您看到的图像背景显示为黑色而不是蓝色: