<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
div {
height: 800px;
}
#one,
#one1 {
/* background-color: #f00; */
overflow: auto;
}
#two,
#two1 {
background-color: #ff0;
}
#three,
#three1 {
background-color: #f0f;
}
#four,
#four1 {
background-color: #0f0;
}
#five {
background-color: #00f;
}
</style>
<body style="padding-top: 100px;">
<ul>
<li><a href="#one">one</a></li>
<li><a href="#two">two</a></li>
<li><a href="#three">three</a></li>
<li><a href="#four">four</a></li>
</ul>
<div style="padding-top: 100px;" id="one">
<ul>
<li><a href="#one1">one</a></li>
<li><a href="#two1">two</a></li>
<li><a href="#three1">three</a></li>
<li><a href="#four1">four</a></li>
</ul>
<div style="padding-top: 100px;" id="one1">one1</div>
<div style="padding-top: 100px;" id="two1">two2</div>
<div style="padding-top: 100px;" id="three1">three3</div>
<div style="padding-top: 100px;" id="four1">four4</div>
</div>
<div style="padding-top: 100px;" id="two"></div>
<div style="padding-top: 100px;" id="three"></div>
<div style="padding-top: 100px;" id="four"></div>
<div style="padding-top: 100px;" id="five"></div>
<a style="position: fixed;bottom: 60px;right: 60px;background-color: #ccc;" href="#">返回顶部</a>
<a style="position: fixed;bottom: 80px;right: 60px;background-color: #ccc;"
href="javascript:window.scrollTo(0,0)">返回顶部1</a>
</body>
</html>
锚点定位 (文章)
最新推荐文章于 2022-10-29 09:22:28 发布