web前端全系列 教程
1839个小节阅读:2243.9k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
粘性定位可以被认为是相对定位和固定定位的混合。元素在跨越特定阈值前为相对定位,之后为固定定位
xxxxxxxxxx
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.ad {
width: 100%;
background-color: #ff6524;
}
.ad img{
display: block;
width: 1190px;
height: 100px;
margin: 0 auto;
}
.wrap{
width: 80%;
margin: 0 auto;
}
.head {
width: 100%;
height: 50px;
line-height: 50px;
position: sticky;
top: 0px;
}
.head ul {
list-style: none;
}
.head ul li {
float: left;
padding: 0 10px;
}
h3 {
height: 300px;
}
</style>
</head>
<body>
<div class="container">
<div class="ad">
<img src="./ad.png" alt="">
</div>
<div class="wrap">
<div class="head">
<ul>
<li>导航1</li>
<li>导航2</li>
<li>导航3</li>
<li>导航4</li>
</ul>
</div>
<div class="body">
<h3>标题1</h3>
<h3>标题2</h3>
<h3>标题3</h3>
<h3>标题4</h3>
<h3>标题5</h3>
<h3>标题6</h3>
<h3>标题7</h3>
</div>
</div>
</div>
</body>
</html>
sticky
的高度