当我打开材质对话框(MdDialog.open(MyDialogComponent)
)时,打开的对话框会跨越整个屏幕高度。
当我从Chrome检查器中的height:100%
移除.md-dialog-container
时,会调整高度以完全适合内容。
但是md-dialog的源代码使它看起来像是故意的:
md-dialog-container {
...
// The dialog container should completely fill its parent overlay element.
width: 100%;
height: 100%;
...
}
我已经从我的项目中移除了Material for Angular 1,以避免CSS与Angular 2的材质发生冲突。(旧的CSS也使宽度过大。)
导致此问题的原因或如何解决?
我的对话框组件很简单:
<h2 md-dialog-title>...</h2>
<md-dialog-content>
...
</md-dialog-content>
<md-dialog-actions align="end">
<button... />
</md-dialog-actions>
答案 0 :(得分:0)
我的网页缺少<!DOCTYPE html>
https://github.com/angular/material2/issues/2351
有关对话框的详细信息,请参阅此答案: Angular2 Material Dialog css, dialog size