<!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>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.warp_height {
min-height: 100vh;
padding-bottom: 120px; /* padding-bottom: 120px这个等于底部的高度 */
box-sizing: border-box;
}
.header,
.footer {
height: 120px;
background-color: red;
width: 100%;
}
.header {
position: sticky;
top: 0;
left: 0;
}
.content{
background-color: blue;
height: 180px;
}
.footer {
margin-top: -120px;/* margin-top: 120px这个等于底部的高度 */
}
</style>
</head>
<body>
<div class="warp_height">
<div class="header">
头部,固定顶部,不会滚动
</div>
<div class="content">
都是内容
</div>
</div>
<div class="footer">
底部,不足一屏固定在底部;
<br>
超过一屏,置底
</div>
</body>
</html>
当前位置:网站首页>头部固定吸顶,不足一屏footer固定底部,超过一屏滚动,注意看注释
头部固定吸顶,不足一屏footer固定底部,超过一屏滚动,注意看注释
2022-04-22 17:19:00 【四仰八叉的怪】
版权声明
本文为[四仰八叉的怪]所创,转载请带上原文链接,感谢
https://segmentfault.com/a/1190000041743505
边栏推荐
- Leetcode question bank 62 Different paths (recursive C implementation)
- 阿里云容器&服务网格产品技术动态(202203)
- 每周问答精选:PolarDB-X 完全兼容 MySQL 吗?
- [use of Hetai ht32f52352 timer]
- Learn JVM performance optimization
- 机器越“智能”,数据标注员越容易被淘汰?丨曼孚科技
- Opencv frame, draw points, write and draw lines on the picture
- Continuous delivery - Blue Ocean application
- 5个程序员常用的接单平台推荐
- 近期BSN开发常见问题答疑
猜你喜欢

Cisco switch configuration

JMeter accesses the data of SQL Server with comma '' to CSV file

The use of servlets corresponds to the nine built-in objects

每周问答精选:PolarDB-X 完全兼容 MySQL 吗?

Penetration test & Network & CTF interview questions sorting

Interview: artificial intelligence job interview - Framework of necessary knowledge for machine learning algorithm engineers in artificial intelligence job hunting

MySQL log

ES6 proxy and object defineProperty

智能家居的完全形态以及“小 HomeKit”的发展

活动预告 | 4月23日,多场OpenMLDB精彩分享来袭,不负周末好时光!
随机推荐
Is EVM compatible important for gamefi development at this stage?
MySQL configuration parameters and commands
故障分析 | Federated 存储引擎表导致监控线程处于 Opening table 状态
智能家居的完全形态以及“小 HomeKit”的发展
[csnote] paradigm
Yapi本地部署
What are the common interview questions for redis? Redis cluster interview questions and answers
博睿数据携手F5共同构建金融科技从代码到用户的全数据链DNA
Packet capture analysis of interface protocol TCP protocol
Nonlinear optimization problem --- super large object function optimization problem --- matlab
阿里云容器&服务网格产品技术动态(202203)
UML diagram related knowledge
BACKBONE,NECK,HEAD
Sending non-protected broadcast
343 leetcode inverts vowels in a string
automated testing
DHCP snooping
Lightly:新一代的 Go IDE
CrashSight 接入上报常见问题及解决方案
The small magic camel of 128800 yuan is 2.0, and milli Zhixing holds up the commercial dream of automatic distribution of terminal logistics