我尝试使用 z-index 使侧边栏与标题重叠,但无法这样做。
header {
width: 100%;
height: 50px;
background-color: blue;
z-index: 0;
}
aside {
height: 100vh;
width: 300px;
background-color: green;
z-index: 200;
}
<body>
<header></header>
<aside></aside>
</body>
最佳答案
为.aside
定义position: absolute
header {
width: 100%;
height: 50px;
background-color: blue;
}
aside {
height: 100vh;
width: 300px;
position: absolute;
top: 0;
background-color: green;
}
<body>
<header></header>
<aside></aside>
</body>
关于css - 如何使侧边栏与标题重叠?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41212990/