微信小程序样式Flex Box精通课程-Flex容器的属性-justify-content内容对齐(左中右)

justify-content内容对齐

微信小程序交流群:111733917 | 微信小程序从0基础到就业的课程:https://edu.csdn.net/topic/huangjuhua

基础语法
justify-content属性定义了项目在主轴上的对齐方式。(左中右)
在这里插入图片描述

.box { 
justify-content: flex-start | flex-end | center | space-between | space-around; 
} 

 flex-start(默认值):左对齐
 flex-end:右对齐
 center: 居中
 space-between:两端对齐,项目之间的间隔都相等。
 space-around:每个项目两侧的间隔相等。所以,项目之间的间隔比项目与边框的间隔大一倍。

小程序应用

justify-content: flex-start

效果如图
justify-content: flex-start

Wxml代码

<view class='zong'>
   <view class='fangxing'>
    <text>01</text>
  </view>
  <view  class='fangxing'>
    <text>02</text>
  </view>
</view>

Wxss代码

/* */
.zong{
  display: flex; 
  justify-content:  flex-start;
/*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}
.fangxing{
  width: 100px; height: 100px;  
  background-color:  beige;
}

justify-content: flex-end
效果如图
justify-content: flex-end
wxml代码沿用上小节

Wxss代码

.zong{
  display: flex; 
  justify-content:  flex-end;
  /*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}

justify-content: center
效果如图
wxml代码沿用上小节

Wxss代码

.zong{
  display: flex; 
  justify-content:  center;
  /*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}

justify-content: space-between
效果如图
在这里插入图片描述
wxml代码沿用上小节

Wxss代码

.zong{
  display: flex; 
  justify-content:  space-between;
  /*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}

justify-content: space-around
效果如图
justify-content: space-around
wxml代码沿用上小节

Wxss代码

.zong{
  display: flex; 
  justify-content:  space-around;
  /*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}

欢迎大家收看我的视频教程:微信小程序界面设计布局Flex Box精通课程 (微信小程序界面设计必备技能)

微信小程序样式Flex Box精通课程

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黄菊华老师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值