【发布时间】:2022-01-21 16:20:45
【问题描述】:
试图将图像移到MUI dialog 之外,这样图像的底部将在对话框内,而图像的上部将在对话框外。我已尝试实施此解决方案CSS: position nested element slightly outside of parent element's bounds,但它不起作用。
这是我的对话:
<Dialog open={this.state.open} onEnter={console.log("Hey.")}>
<div className="dialog-logo-outside" />
<DialogTitle>Hello CodeSandbox</DialogTitle>
<DialogContent>Start editing to see some magic happen!</DialogContent>
</Dialog>
这是 CSS:
.App {
font-family: sans-serif;
text-align: center;
}
.dialog-logo-outside {
width: 100px;
height: 100px;
position: absolute;
background-repeat: no-repeat;
background-size: 100% 100%;
top: -50px;
background-image: url(https://i.imgur.com/24p8XE7.jpg);
}
您可以在此处查看沙盒中的示例:https://codesandbox.io/s/material-ui-dialog-sample-forked-8w5wt
【问题讨论】:
标签: html css material-ui