当前位置:网站首页>Mobile web training day-2
Mobile web training day-2
2022-06-28 13:06:00 【HHppGo】
3. Flex Layout
3.1 Part of the
- effect :
- be based on Flex Accurately and flexibly control the layout of block level boxes , Avoid separation from document flow in floating layout .
- Flex Layout Very suitable for structured layout
- Setting mode :
- The parent element adds
display: flex
- Tips : there Parent element Must be Dad
- The parent element adds
- Part of the :
- Elastic container : Parent element , Dad
- Elastic box : Subelement
- Spindle : The default is the horizontal direction , therefore flex By default, the layout is arranged horizontally along the main axis
- Side axle : The default is vertical
3.2 Spindle alignment :justify-content
effect : Adjust the spacing between the main axes of the elastic box
/* flex Layout */
display: flex;
/* Adjust the horizontal spacing */
/* The default value is , From left to right , No spacing */
/* justify-content: flex-start; */
/* The default value is , From right to left , No spacing */
/* justify-content: flex-end; */
/* Center along the main axis , No spacing */
/* justify-content: center; */
/* In the direction of the spindle , Each box has the same left-right spacing */
/* justify-content: space-around; */
/* In the direction of the spindle , The leftmost and rightmost boxes are close to the left and right of the parent , The gap tie is allocated to other joint ventures */
/* justify-content: space-between; */
/* In the direction of the spindle , Each elastic box has the same spacing */
justify-content: space-evenly;
3.3 Side axis alignment :align-items
effect : Adjust the position of the side axis direction of the elastic box
The key is Vertical center :
center
.box {
/* Horizontal arrangement */
display: flex;
/* Side axis alignment : Vertically centered ( important ) */
/* align-items: center; */
/* The default value is , The elastic box will move along the side axis Stretch to the height of the elastic container */
align-items: stretch;
height: 300px;
margin: auto;
border: 1px solid #000;
}
/* Elastic box size description : Elastic layout , If the elastic box is not set with a fixed size , The default is the content size A flexible box , Similar to inline block display mode , Can set size , The default box size can also be determined by the content */
3.4 Expansion ratio
effect : Adjust the width of the elastic box occupying the rest of the elastic container
Code :
/* Means to divide the remaining part of the elastic container into 2 branch 2 Elastic box No 2 Share */
/* The second elastic box */
.box div:nth-child(2) {
/* Set the elastic box expansion ratio */
flex: 2;
}
effect :
Code :
/* Means to divide the remaining part of the elastic container into 6 branch 2 Elastic box No 2 Share 3 Elastic box No 4 Share */
/* The second elastic box */
.box div:nth-child(2) {
/* Set the elastic box expansion ratio */
flex: 2;
}
/* The third elastic box */
.box div:nth-child(3) {
flex: 4;
}
effect :
边栏推荐
- fastposter v2.8.4 发布 电商海报生成器
- PHP根据年月获取月初月末时间
- PHP抓取网页获取特定信息
- Après avoir échoué à l'examen d'entrée à l'Université de technologie de Harbin, vous devez rester à l'Université en tant que « chercheur » après avoir obtenu votre diplôme.
- Summary of 2022 China Merchants fintech competition
- Embedded development: seven techniques for estimating battery life
- 【MySQL从入门到精通】【高级篇】(三)MySQL用户的创建_修改_删除以及密码的设置
- How to handle the safest account opening when downloading the mobile app of Huatai Securities
- 895. 最长上升子序列
- CodeBlocks MinGW installation configuration problem
猜你喜欢
Copy 10 for one article! The top conference papers published in South Korea were exposed to be plagiarized, and the first author was "original sin"?
I²C、SMBus、PMBus关系
数字孪生能源系统,打造低碳时代“透视”眼
一种跳板机的实现思路
Oceanwide micro fh511 single chip microcomputer IC scheme small household appliances LED lighting MCU screen printing fh511
移动Web实训DAY-1
The press conference of Tencent cloud Database & CSDN engineer's ability lightweight certification is coming
Mysq 8.0 launched histogram, which greatly improved the performance!
##测试bug常用“Redmine”
腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”
随机推荐
一款自动生成单元测试的 IDEA 插件,开发效率提升 70% 以上!
Scratch travel photo album Electronic Society graphical programming scratch grade examination level 1 true questions and answers analysis June 2022
ASP. NET CORE Study08
Jerry's wif interferes with Bluetooth [chapter]
证券账户开户哪家的费率低 怎么办理开户最安全
[cloud native] can self-service reports and Bi do so many things?
$100000 AI competition: the task of finding "worse" big models
FS7022方案系列FS4059A双节两节锂电池串联充电IC和保护IC
async-validator. JS data verifier
ASP. NET CORE Study06
Tiantian mathematics serial 53: February 22
Hisilicon 35xx realizes gt911 touch screen function "suggestions collection"
Go语学习笔记 - gorm使用 - 数据库配置、表新增 | Web框架Gin(七)
【MySQL从入门到精通】【高级篇】(三)MySQL用户的创建_修改_删除以及密码的设置
数启扬帆,智聚人才 | 腾讯云数据库 & CSDN 工程师能力轻量认证发布会重磅来袭!...
弹性盒子自动换行小Demo
codeblocks mingw安装配置问题
Mature case and source code of hash quiz game system development technology
Implementation of fruit and vegetable mall management system based on SSM
ASP. NET CORE Study11