已经尝试过父容器的高度,但似乎不起作用
body{
background-color: var(--Off-Black);
margin: auto;
align-content: center;
position: relative;
justify-content: center;
height: 100%;
align-self: center;
}
.content {
align-items: center;
justify-content: center;
text-align: center;
margin: 25px;
padding-left: auto;
padding-right: auto;
text-wrap: nowrap;
height: 100% ;
}
.contentcontainer {
background-color: var(--Dark-Grey);
margin-top: 5em;
justify-content: center;
position: absolute;
align-items: center;
justify-content: center;
padding-right: auto;
padding-left: auto;
border-radius: 15px;
display: flex;
top: 50%;
left: 50%;
height: 100%;
transform: translate(-50%, -50%);
}
定位可能存在问题。尝试这样的事情。
body {
background-color: var(--Off-Black);
margin: auto;
align-content: center;
position: relative;
justify-content: center;
height: 100vh; /* Add this line */
align-self: center;
}
提供更多代码内容可能会有所帮助。