【发布时间】:2021-08-09 18:22:50
【问题描述】:
我试图在我的项目中将头像材质 ui 组件居中,我尝试了很多东西,包括文本对齐、对齐内容、自动边距,但似乎没有任何效果。任何帮助将不胜感激
/////profile.js///////
<div className="myProfile__outterContainer">
<div className="myProfile__innerContainer">
<div className="myProfile__header">
<h2>My Profile</h2>
<Avatar
alt={user.displayName}
src={user.photoURL}
className={classes.large}
/>
<h2>Welcome, {user.displayName}</h2>
</div>
</div>
</div>
////// profile .css below
profile.css
.myProfile__outterContainer {
display: flex;
justify-content: center;
margin-top: 5vh;
}
.myProfile__innerContainer {
position: relative;
width: 800px;
padding: 20px;
max-width: 85vw;
height: 75vh;
border-radius: 20px;
background-size: cover;
background-position: center;
box-shadow: 0px 18px 53px 0px rgba(0, 0, 0, 0.3);
}
.myProfile__header {
text-align: center;
justify-content: center;
}
【问题讨论】:
标签: javascript css reactjs material-ui