当前位置:网站首页>Flexible layout (I)
Flexible layout (I)
2022-07-07 07:14:00 【Luqi zz】
Catalog
1 Declare block level elastic box display:flex
2 Declare inline elastic box display:inline-flex
Two 、flex-direction: Used to control the arrangement direction of box elements .
row-reverse Arrange elements from right to left
column-reverse Arrange elements vertically from bottom to top
Vertical element wrap column 、wrap
Vertical elements wrap in reverse column wrap-reverse
One 、 Declaration definition
Container box contains container elements , Use display:flex or display:inline-flex Declared as an elastic box .
1 Statement Block level Elastic box display:flex

<style>
* {
padding: 0;
margin: 0;
}
article {
height: 150px;
margin-left: 100px;
margin-top: 100px;
outline: solid 5px silver;
display: flex;
padding: 20px;
}
article div {
outline: solid 5px orange;
text-align: center;
font-size: 28px;
line-height: 5em;
width: 300px;
}
</style>
<!-- Declare block level elastic box -->
<body>
<article>
<div>1</div>
<div>2</div>
<div>3</div>
</article>
</body>2 Declare inline elastic box display:inline-flex

<style>
...
article {
...
display: inline-flex;
...
}
...
</style>Two 、flex-direction: Used to control the arrangement direction of box elements .
Use in display:flex In the parent container of , Change the direction of the horizontal axis :
| value | describe |
|---|---|
| row | Arrange elements horizontally from left to right ( The default value is ) |
| row-reverse | Arrange elements from right to left |
| column | Arrange elements vertically from top to bottom |
| column-reverse | Arrange elements vertically from bottom to top |
row-reverse Arrange elements from right to left

<style>
* {
padding: 0;
margin: 0;
}
body {
margin: 100px;
font-size: 14px;
color: #555;
}
article {
width: 500px;
border: solid 5px silver;
display: flex;
box-sizing: border-box;
padding: 10px;
/* row-reverse Arrange elements from right to left */
flex-direction: row-reverse;
}
article * {
border: solid 5px orange;
padding: 10px;
margin: 10px;
}
</style>
...
<body>
<article>
<h4>1</h4>
<span>2</span>
<p>3</p>
</article>
</body>
column-reverse Arrange elements vertically from bottom to top

<style>
* {
padding: 0;
margin: 0;
}
body {
margin: 100px;
font-size: 14px;
color: #555;
}
article {
width: 500px;
border: solid 5px silver;
display: flex;
box-sizing: border-box;
padding: 10px;
/* column-reverse Arrange elements vertically from bottom to top */
flex-direction: column-reverse;
}
article * {
border: solid 5px orange;
padding: 10px;
margin: 10px;
}
</style>
...
<body>
<article>
<h4>1</h4>
<span>2</span>
<p>3</p>
</article>
</body>
3、 ... and 、flex-wrap
Regulations flex The container is one or more lines , At the same time, the direction of the horizontal axis determines the direction of the new row stack .
| Options | explain |
|---|---|
| nowrap | Elements do not split rows or columns ( The default value is ) |
| wrap | Container elements split rows or columns when necessary . |
| wrap-reverse | Container elements split rows or columns when necessary , But in reverse order |
Line element wrap row 、wrap

<style>
* {
padding: 0;
margin: 0;
outline: solid 1px silver;
padding: 10px;
margin: 10px;
}
head {
display: block;
}
body {
font-size: 14px;
color: #555;
}
article {
width: 500px;
height: 250px;
border: solid 5px silver;
box-sizing: border-box;
padding: 10px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
article div {
border: solid 5px orange;
padding: 30px 80px;
margin: 10px;
text-align: center;
font-size: 28px;
}
</style>
...
<article>
<div>1</div>
<div>2</div>
<div>3</div>
</article>Horizontal arrangement reverse line feed row 、wrap-reverse

flex-direction: row;
flex-wrap: wrap-reverse;
Vertical element wrap column 、wrap

flex-direction: column;
flex-wrap: wrap;Vertical elements wrap in reverse column wrap-reverse

flex-direction: column;
flex-wrap: wrap-reverse;Four 、flex-flow
yes flex-direction And flex-wrap The combination abbreviation mode of .
The following is arranged from right to left , Line breaking up branches .

flex-flow: row-reverse wrap-reverse;边栏推荐
- Paranoid unqualified company
- 多线程与高并发(9)——AQS其他同步组件(Semaphore、ReentrantReadWriteLock、Exchanger)
- sql中对集合进行非空校验
- Abnova membrane protein lipoprotein technology and category display
- Non empty verification of collection in SQL
- CompletableFuture使用详解
- Anr principle and Practice
- Composition API premise
- Sqlserver multithreaded query problem
- JS decorator @decorator learning notes
猜你喜欢

Bindingexception exception (error reporting) processing

Basic process of network transmission using tcp/ip four layer model

Circulating tumor cells - here comes abnova's solution

jdbc数据库连接池使用问题

Pass child component to parent component

After the promotion, sales volume and flow are both. Is it really easy to relax?

Use of completable future

LC 面试题 02.07. 链表相交 & LC142. 环形链表II
![[noi simulation] regional division (conclusion, structure)](/img/7d/4c66cd0a30e52ccd167b6138fcb4df.png)
[noi simulation] regional division (conclusion, structure)

Leetcode t1165: log analysis
随机推荐
Four goals for the construction of intelligent safety risk management and control platform for hazardous chemical enterprises in Chemical Industry Park
JDBC database connection pool usage problem
Precise space-time travel flow regulation system - ultra-high precision positioning system based on UWB
MySQL binlog related commands
Unity C function notes
This article introduces you to the characteristics, purposes and basic function examples of static routing
请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
Complete process of MySQL SQL
Abnova immunohistochemical service solution
How to share the same storage among multiple kubernetes clusters
Distributed ID solution
toRefs API 与 toRef Api
计算机服务中缺失MySQL服务
关于数据库数据转移的问题,求各位解答下
Mysql---- import and export & View & Index & execution plan
Explain Bleu in machine translation task in detail
js小练习----分时提醒问候、表单密码显示隐藏效果、文本框焦点事件、关闭广告
Leetcode t1165: log analysis
Bus message bus
Initial experience of addresssanitizer Technology