站长网 Unix 全面了解flex的用途

全面了解flex的用途

一、可以利用flex来布局一个div在另一个div里面水平垂直居中 如:html代码: divdiv/div/div css代码: .container{width:600px;height:400px;border:1px solid blue;display: flex;justify-content:center;align-items:center;}.box{width:200px;height:1

一、可以利用flex来布局一个div在另一个div里面水平垂直居中

如:html代码: 

<div>
<div>
</div>
</div>

css代码:

.container{
width:600px;
height:400px;
border:1px solid blue;
display: flex;
justify-content:center;
align-items:center;
}
.box{
width:200px;
height:100px;
border:1px red solid;

ps:这样就可以水平垂直居中咯

二、flex的属性

<div>
<div>1</div>
<div>23</div>
<div>4</div>
</div>

可以写在items上的属性有六个:

•flex-direction
•flex-wrap
•flex-flow
•justify-content
•align-items
•align-content

可以写在item上的有6个:

•order//这个就是item单独给了,要是想让那个item调换顺序就给这个属性给那个item
•flex-grow
•flex-shrink
•flex-basis
•flex
•align-self

以上就是小编为大家带来的全面了解flex的用途全部内容了,希望大家多多支持脚本之家~

本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/server/unix/2021/0527/6930.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部