当前位置:网站首页>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;边栏推荐
- .net 5 FluentFTP连接FTP失败问题:This operation is only allowed using a successfully authenticated context
- 请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
- Freeswitch dials extension number source code tracking
- Initial experience of addresssanitizer Technology
- Procedure in PostgreSQL supports transaction syntax (instance & Analysis)
- MySQL binlog related commands
- Graduation design game mall
- Détailler le bleu dans les tâches de traduction automatique
- How to model and simulate the target robot [mathematical / control significance]
- Explain Bleu in machine translation task in detail
猜你喜欢

Bus message bus

main函数在import语句中的特殊行为

LC interview question 02.07 Linked list intersection & lc142 Circular linked list II

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

Circulating tumor cells - here comes abnova's solution

SQLMAP使用教程(四)实战技巧三之绕过防火墙

The latest trends of data asset management and data security at home and abroad

Bindingexception exception (error reporting) processing

Non empty verification of collection in SQL

Basic introduction of JWT
随机推荐
Abnova membrane protein lipoprotein technology and category display
linux系统rpm方式安装的mysql启动失败
组件的嵌套和拆分
MySQL的主从复制原理
Communication of components
A slow SQL drags the whole system down
The startup of MySQL installed in RPM mode of Linux system failed
Special behavior of main function in import statement
Under what circumstances should we consider sub database and sub table
After the promotion, sales volume and flow are both. Is it really easy to relax?
Reflection (II)
Lm11 reconstruction of K-line and construction of timing trading strategy
请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
. Net core accesses uncommon static file types (MIME types)
How can flinksql calculate the difference between a field before and after update when docking with CDC?
【mysqld】Can't create/write to file
Fast quantitative, abbkine protein quantitative kit BCA method is coming!
Advantages of using net core / why
[Luogu p1971] rabbit and egg game (bipartite game)
栈题目:有效括号的嵌套深度