边距顶部菜单移动内容

Xhonor

“.fullpage”块和内容上的滚动条有问题。由于顶部菜单在 30 像素处缩进,底部内容也将视图保留在相同的 30 像素上。怎样成为?

PS 在外部,页面应该看起来完全一样。顶级菜单应与一般内容分开。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<style>
    html {
    height: 100%;
    margin: 0;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.35);
}

::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.25);
}

body {
    overflow: hidden;
    height: 100%;
    width: 100%;
    margin: 0;
    background-color: #141320;
    color: white;
}

.draggable {
    -webkit-app-region: drag;
}

.center {
    display: flex;
    justify-content: center;
    align-items: center;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    position: absolute;
}

.center .btn {
    border-radius: 4px; 
    margin: 7px;
}

button {
    -webkit-app-region: no-drag;
}

.fullpage {
    position: absolute;
    overflow: auto;
    width: 100%;
    height: 100%;
    margin-top: 30px;
}

.topmenu {
    top: 0;
    overflow: hidden;
    width: 100%;
    height: 30px;
    position: fixed;
    background-color: rgba(255, 255, 255, 0.05);
    z-index: 99999;
}

</style>
</head>
<body>
    <div class="topmenu draggable"></div>
    <div class="fullpage">
        123123123
        <div class="center">
            <button class="btn btn-info">Test</button>
            <button class="btn btn-primary">Test 2</button>
            <button class="btn btn-success test">Test 3</button>
        </div>
        <div style="margin-top: 1400px; width: 30px; height: 31px; background-color: aqua;"></div>
    </div>
</body>
</html>

补充:由于某种原因,顶部菜单不再透明。内容在其下方完全消失,好像 rgba 不具有透明度(

Xhonor

问题解决了!

html {
    height: 100%;
    margin: 0;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.35);
}

::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.25);
}

body {
    height: 100%;
    width: 100%;
    margin: 0;
    background-color: #141320;
    color: white;
    z-index: 99998;
}

.draggable {
    -webkit-app-region: drag;
}

button {
    -webkit-app-region: no-drag;
}

.fullpage {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow-y: scroll;
}

.topmenu {
    top: 0;
    overflow: hidden;
    width: 100%;
    height: 30px;
    position: fixed;
    background-color: rgba(255, 255, 255, 0.05);
    z-index: 99999;
}

.content {
    margin-top: 30px;
}

.center {
    display: flex;
    justify-content: center;
    align-items: center;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    position: absolute;
}

    .center .btn {
        border-radius: 4px;
        margin: 7px;
    }
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
    <div class="fullpage">
        <div class="topmenu draggable"></div>
        <div class="content">
            123123123
            <div class="center">
                <button class="btn btn-info">Test</button>
                <button class="btn btn-primary">Test 2</button>
                <button class="btn btn-success test">Test 3</button>
            </div>
            <div style="margin-top: 1400px; width: 50px; height: 60px; background-color: aqua;"></div>
        </div>
    </div>

</body>
</html>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章