我有一个position: sticky添加了侧边栏的工具栏 ,但是当我滚动超过某个点时,它不再发粘吗?!
已在Chrome版本:61.0.3163.100和Safari版本:11.0中进行测试
HTML:
<div class="sticky">
this should stick!
</div>
<div class="content">
this is content
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
<style media="screen">
.sticky {
background-color: #ccc;
position: -webkit-sticky;
position: -moz-sticky;
position: -ms-sticky;
position: -o-sticky;
position: sticky;
top: 15px;
width: 100px;
float: left;
}
.content{
background-color: #eee;
height: 3000px;
width: 700px;
float: right;
}
</style>
Run Code Online (Sandbox Code Playgroud) css3 ×1