当前位置:网站首页>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).
边栏推荐
- Open cooperation and win-win future | Fuxin Kunpeng joins Jinlan organization
- Synchronous FIFO
- 模型效果优化,试一下多种交叉验证的方法(系统实操)
- LINQ 查询(2)
- Interview tutorial - multi thread knowledge sorting
- Question 1: the container that holds the most water
- AWTK 最新动态:Grid 控件新用法
- 从 jsonpath 和 xpath 到 SPL
- Swift Extension NetworkUtil(网络监听)(源码)
- Leetcode 207: course schedule (topological sorting determines whether the loop is formed)
猜你喜欢

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

GraphMAE----論文快速閱讀

有关iframe锚点,锚点出现上下偏移,锚点出现页面显示问题.iframe的srcdoc问题

Gossip: what happened to 3aC?
![[nilm] non intrusive load decomposition module nilmtk installation tutorial](/img/d0/bc5ea1cbca9ee96a2fe168484ffec4.png)
[nilm] non intrusive load decomposition module nilmtk installation tutorial

Vulnhub靶机:BOREDHACKERBLOG: SOCIAL NETWORK

OC extension detects whether an app is installed on the mobile phone (source code)

1279_VMWare Player安装VMWare Tools时VSock安装失败解决

Keep one decimal place and two decimal places

宝塔面板安装php7.2安装phalcon3.3.2
随机推荐
Open cooperation and win-win future | Fuxin Kunpeng joins Jinlan organization
GraphMAE----论文快速阅读
More than observation | Alibaba cloud observable suite officially released
AWTK 最新动态:Grid 控件新用法
Echart 心得 (一): 有关Y轴yAxis属性
The applet reads more than 20 data, and the cloud function reads more than 100 restrictions
Jenkins is too old try it? Cloud native ci/cd Tekton
Do you still have the opportunity to become a machine learning engineer without professional background?
Unity culling related technologies
Chapter 4 line operation of canvas
单片机STM32F103RB,BLDC直流电机控制器设计,原理图、源码和电路方案
Solve the problem of notebook keyboard disabling failure
Vscode topic recommendation
Getting started with crawler to giving up 06: crawler play Fund (with code)
Moonwell Artemis is now online moonbeam network
Methods of vector operation and coordinate transformation
【资料上新】迅为基于3568开发板的NPU开发资料全面升级
FPGA的虚拟时钟如何使用?
Search and recommend those things
基金的募集,交易与登记