flex布局的flex-direction属性
flex-direction
flex-direction是css做灵活布局最常用的一个属性,决定主轴的方向,即项目的排列方向
flex-direction属性有四个常用值和两个默认值:
row | 默认值。灵活的项目将水平显示,正如一个行一样。 |
row-reverse | 与 row 相同,但是以相反的顺序。 |
column | 灵活的项目将垂直显示,正如一个列一样。 |
column-reverse | 与 column 相同,但是以相反的顺序。 |
initial | 设置该属性为它的默认值。 |
inherit | 从父元素继承该属性。 |
实例:
<div id="main">
<div style="background-color:coral;">A</div>
<div style="background-color:lightblue;">B</div>
<div style="background-color:khaki;">C</div>
<div style="background-color:pink;">D</div>
<div style="background-color:lightgrey;">E</div>
<div style="background-color:lightgreen;">F</div>
</div>
<style>
#main {
width: 400px;
height: 400px;
border: 1px solid #c3c3c3;
display: flex;
flex-direction: row-reverse;
}
</style>
结果:
版权声明:
作者:jenkin
链接:https://blog.ijenkin.top/index.php/2022/02/12/flexbjdflexdirectionsx/
来源:Jenkin
文章版权归作者所有,未经允许请勿转载。
THE END
二维码
文章目录
关闭
共有 0 条评论