contentcontainer(div) bgcolor 未显示

问题描述 投票:0回答:1

我认为我的代码有问题,因为内容的 div 容器(*bg 颜色未显示)(这里是菜鸟)

已经尝试过父容器的高度,但似乎不起作用

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%);
}
html css containers
1个回答
0
投票

定位可能存在问题。尝试这样的事情。

body {
    background-color: var(--Off-Black);
    margin: auto;
    align-content: center;
    position: relative;
    justify-content: center;
    height: 100vh; /* Add this line */
    align-self: center;
}

提供更多代码内容可能会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.