当前位置:网站首页>Overflow: the combination of auto and Felx
Overflow: the combination of auto and Felx
2022-07-04 16:45:00 【Elephants and ants】
overflow:auto; If the content is trimmed , The browser will display a scroll bar , To see the rest .
flex Properties in
display: flex;
flex-direction: column; The principal axis is perpendicular , The starting point is at the top .
1、overflow and flex Layout collocation
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>overflow:auto Usage of </title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<style type="text/css">
html,body{
width: 100%;
height: 100%;
}
.container{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.header{
width: 100%;
height: 100px;
background: #f99;
}
.content{
width: 100%;
height: 100%;
overflow: auto;
background: yellow;
flex: 1;
}
.footer{
width: 100%;
height: 100px;
background: #99f;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
</div>
<div class="content">
<ul>
<li>111111</li>
<li>111111</li>
<li>111111</li>
<li>111111</li>
<li>111111</li>
<li>111111</li>
<li>111111</li>
<li>111111</li>
there li Write more , This will show the effect , I'm here to save space .
</ul>
</div>
<div class="footer">
</div>
</div>
</body>
</html>
To achieve overflow: auto; This effect , First, layout , Then write the style .
The outermost parent box in the style container, Add the following style :
.container{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
Also, you must give html and body Give width and height 100%;
html,body{
width: 100%;
height: 100%;
}
The head and bottom are given a fixed height , General app The head and bottom of the are fixed , Like wechat chat record .
.header{
width: 100%;
height: 100px;
background: #f99;
}
.footer{
width: 100%;
height: 100px;
background: #99f;
}
In the middle of the content Given flex:1, And add our protagonist overflow:auto; Excess content is automatically cropped .
.content{
width: 100%;
height: 100%;
overflow: auto;
background: yellow;
flex: 1;
}
The renderings are as follows :
The middle content area can slide up and down , The excess part is automatically cropped .
边栏推荐
- Feature extraction and detection 15-akaze local matching
- 《吐血整理》保姆级系列教程-玩转Fiddler抓包教程(2)-初识Fiddler让你理性认识一下
- Accounting regulations and professional ethics [7]
- [North Asia data recovery] a database data recovery case where the disk on which the database is located is unrecognized due to the RAID disk failure of HP DL380 server
- Using celery in projects
- Hair growth shampoo industry Research Report - market status analysis and development prospect forecast
- Change the mouse pointer on ngclick - change the mouse pointer on ngclick
- 高度剩余法
- Research Report on surgical otorhinolaryngology equipment industry - market status analysis and development prospect prediction
- Market trend report, technical innovation and market forecast of electrochromic glass and devices in China and Indonesia
猜你喜欢
165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version
Common knowledge of unity Editor Extension
NoSQL之readis配置与优化(终章)
Object.keys()的用法
多年锤炼,迈向Kata 3.0 !走进开箱即用的安全容器体验之旅| 龙蜥技术
Talking about Net core how to use efcore to inject multiple instances of a context annotation type for connecting to the master-slave database
Web components series - detailed slides
[hcie TAC] question 5 - 1
PR FAQ: how to set PR vertical screen sequence?
TypeError: list indices must be integers or slices, not str
随机推荐
实战:fabric 用户证书吊销操作流程
QT graphical view frame: element movement
Proxifier global agent software, which provides cross platform port forwarding and agent functions
Interface test - knowledge points and common interview questions
Research Report on plastic recycling machine industry - market status analysis and development prospect forecast
Research Report on surgical otorhinolaryngology equipment industry - market status analysis and development prospect prediction
[North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server
Inside and outside: flow chart drawing elementary: six common mistakes
Model fusion -- stacking principle and Implementation
Talking about Net core how to use efcore to inject multiple instances of a context annotation type for connecting to the master-slave database
表单传递时,如何隐式将值传过去
C # realizes FFT forward and inverse transformation and frequency domain filtering
Talking about Net core how to use efcore to inject multiple instances of a context annotation type for connecting to the master-slave database
Integration of ongdb graph database and spark
C implementation defines a set of intermediate SQL statements that can be executed across libraries
Recommend 10 excellent mongodb GUI tools
China's roof ladder market trend report, technological innovation and market forecast
How to contribute to the source code of ongdb core project
线程池的使用和原理
Some fields of the crawler that should be output in Chinese are output as none