【CSS】仿京东锚点侧边栏效果
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
ul {
list-style: none;
position: fixed;
top: 100px;
right: 0px;
}
li {
width: 38px;
height: 38px;
line-height: 19px;
font-size: 14px;
padding: 10px;
text-align: center;
border: 0px solid #333;
font-weight: bold;
transition: color .2s ease;
}
li:hover{
background: #e1251b;
}
li>a{
text-decoration: none;
color: #333;
}
li:hover a{
color: white;
}
div{
height: 600px;
border: 1px solid #ccc;
}
</style>
</head>
<body>
<ul>
<li><a href="#miaosha">京东秒杀</a></li>
<li><a href="#tese">特色优选</a></li>
<li><a href="#guangchang">频道广场</a></li>
<li><a href="#tuijian">为你推荐</a></li>
<li><a href="#kefu">客服</a></li>
<li><a href="#fankui">反馈</a></li>
</ul>
<div id="miaosha">京东秒杀</div>
<div id="tese">特色优选</div>
<div id="guangchang">频道广场</div>
<div id="tuijian">为你推荐</div>
</body>
</html>
本文来自博客园,作者:木子欢儿,转载请注明原文链接:https://www.cnblogs.com/HGNET/p/16200544.html