模仿的是B站的右侧菜单
代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>右侧悬浮菜单</title>
<style>
*{margin: 0;padding: 0;box-sizing: border-box;}
div{border: 1px solid black;}
div>div{border:1px dashed red;}
#topDiv{height: 45px;}
#middleDiv{height: 300px;}
#menuDiv{height: 3000px;}
#bottomDiv{height: 150px;}
/*上面只是单纯设置样式和增加高度*/
#contentDiv>div{
height: 300px;
/*内边距上下为0,左右居中*/
margin: 0 auto;
border:1px dashed blue;
/*属性变化过渡效果*/
transition: width 0.1s ease-out;
}
#list-box{
/*悬浮菜单样式*/
position: fixed;
left: 50%;
margin-left: 510px;
top: 355px;
z-index: 2;
/*属性变化过渡效果*/
transition: margin-left 0.1s ease-out;
}
.item{
/*悬浮菜单内容样式*/
width: 54px;
height: 24px;
line-height: 24px;
text-align: center;
font-size: 12px;
}
/*闲得蛋疼加的响应式布局*/
@media screen and (max-width:1020px){#contentDiv>d