CSS宽度在85%的宽度之内

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

所以我有两个div,分别为15%的宽度和第二个85%的秒,我想在带有背景的点击时添加弹出式窗体,但是当我在背景上设置100%的宽度时,它仅显示在该页面的85%上。它可以在整页上显示吗? pop-bg类在HTML的#main内部CSS:

    position:fixed; 
    height: 100%;
    width:15%;
    margin: 0px;
    background-color: #111;
    border-radius: 0px;  
}
#main {
    width:85%; 
    float: right;
    background: black;  
}
and here background:
.pop-bg {
    background-color: rgba(0, 0, 0, 0.8);
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    display: none;
    justify-content: center;
    align-items: center;
}
html css
1个回答
0
投票

代替100%,将宽度设置为100vw。这意味着它是视口宽度的100%。

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