弹性盒主轴的方向

.wrap{

width: 600px;

height: 400px;

background-color: aquamarine;

display: flex;

/* 主轴的方向----子元素的排列方向 */

flex-direction: row;/* 默认值:水平向右,起点在左端 */

flex-direction: row-reverse;/* 默认值:水平向左,起点在右端 */

flex-direction: column;/* 垂直方向--从上往下,起点在上方 */

flex-direction: column-reverse;/* 垂直方向--从下往上,起点在下方 */

/* 设置主轴的对齐方式、弹性子元素在主轴方向的对齐方式 */

justify-content: flex-start;/* 默认值:主轴在顶端对齐 */

justify-content: flex-end;/*主轴在默端对齐 */

justify-content: center;/* 居中对齐、子元素位于弹性容器中心 */

justify-content: space-between;/* 两端对齐、子元素和子元素之间有空白、项目之件的间距相等 */

justify-content: space-around;/* 四周对齐、子元素之前、之间、之后都有空白、并且空白自行分配。项目和项目之间的间隔要比项目和边框之间的间距大一倍 */

justify-content: space-evenly;/* 平均分配、项目和项目之间、项目与边框之间、间距相等 */

}

.wrap div{

width: 100px;

height: 100px;

}

.wrap div:nth-child(1){

background-color: aqua;

}

.wrap div:nth-child(2){

background-color: rgb(52, 68, 68);

}

.wrap div:nth-child(3){

background-color: rgb(50, 214, 50);

}

</style>

</head>

<body>

<div class="wrap">

<div>1</div>

<div>2</div>

<div>3</div>

</div>

</body>

</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值