当前位置:网站首页>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).
边栏推荐
- 有关iframe锚点,锚点出现上下偏移,锚点出现页面显示问题.iframe的srcdoc问题
- 基金的募集,交易与登记
- Practice of opengauss database on CentOS, configuration
- LINQ 查询(2)
- 2022 PMP project management examination agile knowledge points (1)
- Model effect optimization, try a variety of cross validation methods (system operation)
- 自动化测试的未来趋势
- [data update] Xunwei comprehensively upgraded NPU development data based on 3568 development board
- All you know is the test pyramid?
- Pipeline concept of graphic technology
猜你喜欢

【资料上新】迅为基于3568开发板的NPU开发资料全面升级

Backup and restore SQL Server Databases locally

Graphmae - - lecture rapide des documents

The first exposure of Alibaba cloud's native security panorama behind the only highest level in the whole domain

Application of JDBC in performance test

一文理解同步FIFO

单片机STM32F103RB,BLDC直流电机控制器设计,原理图、源码和电路方案
![[C language] system date & time](/img/de/faf397732bfa4920a8ed68df5dbc48.png)
[C language] system date & time

OC Extension 检测手机是否安装某个App(源码)

Coordinate transformation of graphic technology
随机推荐
5-if语句(选择结构)
These dependencies were not found: * core JS / modules / es6 array. Fill in XXX
模型效果优化,试一下多种交叉验证的方法(系统实操)
AWTK 最新动态:Grid 控件新用法
Leetcode 174 Dungeon games (June 23, 2022)
How to design a highly available and extended image storage function
UTC、GMT、CST
有关iframe锚点,锚点出现上下偏移,锚点出现页面显示问题.iframe的srcdoc问题
Leetcode 207: course schedule (topological sorting determines whether the loop is formed)
3-list introduction
MySQL source and target table row count check
Easyplayerpro win configuration full screen mode can not be full screen why
Swift Extension NetworkUtil(网络监听)(源码)
The first exposure of Alibaba cloud's native security panorama behind the only highest level in the whole domain
一文理解同步FIFO
OC Extension 检测手机是否安装某个App(源码)
Gossip: what happened to 3aC?
Keep one decimal place and two decimal places
Sql语句内运算问题
Chapter 3 curve graph of canvas