当前位置:网站首页>For a detailed explanation of flex:1, flex:1
For a detailed explanation of flex:1, flex:1
2022-06-24 08:14:00 【imkaifan】
flex:1 Is a concatenation of three attributes :flex-grow、flex-shrink、flex-basis
flex-grow: Property defines the method scale of the project , The default is 0, That is, if there is any remaining space , Not to zoom in
If all the projects flex-grow All for 1, Then they will divide the remaining space equally .
If a project flex-grow The attribute is 2, Everything else 1, Then the former will occupy twice as much space as the other items .
flex-shrink: Attribute defines the reduction ratio of the project , The default is 1, namely : If there is not enough space , The change project will be reduced .
If all of the items flex-shrink The attribute is 1, When space runs out , Just wait for the scale to shrink .
If a project flex-shrink The attribute is 0, Other projects are 1, When there's not enough space , by 0 It doesn't shrink .
flex-basis: Property defines before allocating extra space , Spindle space occupied by the project .
Browser according to this property , Calculate if the spindle has extra space , Its default value is auto, That is, the original size of the project
It can be set to follow width or height Property is the same value ( such as 350px), Then the project will occupy a fixed space .
also basis and width At the same time basis Will be able to width kill
<!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>
.box {
width: 500px;
height: 100px;
background-color: hotpink;
display: flex;
}
.box div {
width: 100px;
}
.box div:nth-child(1) {
flex-basis: 50px;
}
.box div:nth-child(2) {
flex-basis: 100px;
}
.box div:nth-child(3) {
flex-basis: 50px;
}
</style>
</head>
<body>
<div class="box">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
</body>
</html>

flex:flex The attribute is flex-grow, flex-shrink and flex-basis Abbreviation , The default value is 0 1 auto
This property has two shortcut values :auto (1 1 auto) and none (0 0 auto).
边栏推荐
- Leetcode 515 find the leetcode path of the maximum [bfs binary tree] heroding in each row
- Phonics
- You get in Anaconda
- Selenium IDE的安装以及使用
- How to cancel the display of the return button at the uniapp uni app H5 end the autobackbutton does not take effect
- 5g industrial router Gigabit high speed low delay
- Moonwell Artemis is now online moonbeam network
- Configure your own free Internet domain name with ngrok
- Vulnhub靶机:BOREDHACKERBLOG: SOCIAL NETWORK
- Atguigu---15- built in instruction
猜你喜欢

Graphmae ---- quick reading of papers

软件工程导论——第二章——可行性研究

Swift Extension ChainLayout(UI的链式布局)(源码)

Review of postgraduate English final exam

Configure your own free Internet domain name with ngrok

Future trends in automated testing
![Leetcode 515 find the leetcode path of the maximum [bfs binary tree] heroding in each row](/img/16/011ba3aef1315c39526daac7e3ec89.png)
Leetcode 515 find the leetcode path of the maximum [bfs binary tree] heroding in each row

C语言_字符串与指针的爱恨情仇

5-if语句(选择结构)

Echart's experience (I): about y axis yaxis attribute
随机推荐
4-operation list (loop structure)
Methods of vector operation and coordinate transformation
Blue Bridge Cup_ Queen n problem
Simple summary of lighting usage
Introduction to software engineering - Chapter 2 - feasibility study
transformers PreTrainedTokenizer类
研究生英语期末考试复习
Swift Extension ChainLayout(UI的链式布局)(源码)
Graphmae - - lecture rapide des documents
从 jsonpath 和 xpath 到 SPL
Chapter 1 overview of canvas
毕业两年月薪36k,说难也不难吧
Pagoda panel installation php7.2 installation phalcon3.3.2
Part 1: building OpenGL environment
VsCode主题推荐
How does dating software cut your leeks
Jenkins is too old try it? Cloud native ci/cd Tekton
4-操作列表(循环结构)
Sql语句内运算问题
Interview tutorial - multi thread knowledge sorting