当前位置:网站首页>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 .
边栏推荐
- What should ABAP do when it calls a third-party API and encounters garbled code?
- Hair and fuzz interceptor Industry Research Report - market status analysis and development prospect forecast
- 表单传递时,如何隐式将值传过去
- Lv166 turned over
- Task state rollback and data blocking tasks based on check point mechanism
- APOC自定义函数和过程
- 基于check-point实现图数据构建任务
- 线程池的使用和原理
- Research Report on market supply and demand and strategy of China's well completion equipment industry
- Final consistency of MESI cache in CPU -- why does CPU need cache
猜你喜欢
Intranet penetrating FRP: hidden communication tunnel technology
error: ‘connect‘ was not declared in this scope connect(timer, SIGNAL(timeout()), this, SLOT(up
Cut! 39 year old Ali P9, saved 150million
Web components series - detailed slides
Object.keys()的用法
What should ABAP do when it calls a third-party API and encounters garbled code?
Interface test - knowledge points and common interview questions
Opencv learning -- geometric transformation of image processing
L1-072 scratch lottery
A trap used by combinelatest and a debouncetime based solution
随机推荐
最大子数组与矩阵乘法
Market trend report, technical innovation and market forecast of electrochromic glass and devices in China and Indonesia
What is torch NN?
多年锤炼,迈向Kata 3.0 !走进开箱即用的安全容器体验之旅| 龙蜥技术
Accounting regulations and professional ethics [8]
基于check-point实现图数据构建任务
Research Report on market supply and demand and strategy of China's four sided flat bag industry
Market trend report, technical innovation and market forecast of China's hair repair therapeutic apparatus
Game theory
[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
error: ‘connect‘ was not declared in this scope connect(timer, SIGNAL(timeout()), this, SLOT(up
NoSQL之readis配置与优化(终章)
C # realizes FFT forward and inverse transformation and frequency domain filtering
What is the catalog of SAP commerce cloud
Move, say goodbye to the past again
Variable cannot have type 'void'
Research Report on market supply and demand and strategy of China's well completion equipment industry
Qt---error: ‘QObject‘ is an ambiguous base of ‘MyView‘
Feature extraction and detection 15-akaze local matching
同构图与异构图CYPHER-TASK设计与TASK锁机制