当前位置: 首页 > news >正文

哈尔滨网站制作前景中囯军事网

哈尔滨网站制作前景,中囯军事网,上海地产网站建设,wordpress 大神元素对齐往往是新学者的一大困惑点&#xff0c;在此总结常用的各种元素和文字对齐方式以供参考&#xff1a; 初始显示 .wxml <view style"width: 100%;height: 500rpx; background-color: lightgray;"><view style"width: 200rpx;height:100rpx;bac…

元素对齐往往是新学者的一大困惑点,在此总结常用的各种元素和文字对齐方式以供参考:

初始显示

.wxml

<view style="width: 100%;height: 500rpx; background-color: lightgray;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

ef07b97875d8449e9a7a2de30d9baa9a.png

初始定义元素,默认显示在左上角。

元素居中

水平居中关键代码:justify-content: center;

竖直居中关键代码:align-items: center;

.wxml

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex; align-items: center; justify-content: center;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

e31744bc81494ffdbfb9a5f09f7ac34f.png

元素水平两端对齐

关键代码:justify-content: space-between;

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex; align-items: center; justify-content: space-between;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

d49ecc078f304c77878ff4838b8403d8.png 

 元素竖直两端对齐

关键代码:flex-direction: column; justify-content: space-between;

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex; flex-direction: column; justify-content: space-between;align-items: center;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

116f1adcc7e045068a56730c5fdfe9be.png

元素左对齐

关键代码:justify-content: flex-start;

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex; justify-content: flex-start;align-items: center;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

0d373a64a79c40d9982502d6d187632c.png 

元素右对齐

关键代码:justify-content:flex-end;

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex; justify-content:flex-end;align-items: center;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

 8633651beb9446eb83f7674a06bac28f.png

元素上对齐

关键代码:flex-direction: column; justify-content:flex-start;

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex;flex-direction: column; justify-content:flex-start;align-items: center;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

6d7afc7dac0146eb8ab9f3c5ae4a9d0e.png 

元素下对齐

关键代码:flex-direction: column; justify-content:flex-end;

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex;flex-direction: column; justify-content:flex-end;align-items: center;"><view style="width: 200rpx;height:100rpx;background-color: aqua;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow">元素2</view>
</view>

955fa34f927c4062ab7c2585dce14802.png

文字居中对齐

文字其他对齐方式可以参考元素对齐

关键代码:justify-content:center;align-items: center;

<view style="width: 100%;height: 500rpx; background-color: lightgray; display: flex; justify-content:center;align-items: center; "><view style="width: 200rpx;height:100rpx;background-color: aqua; display: flex; align-items: center; justify-content: center;">元素1</view><view style="width: 200rpx;height:100rpx; background-color:yellow; display: flex; align-items: center; justify-content: center;">元素2</view>
</view>

e1c01d9772fb46fd8b1d398aaa9934d2.png

可以在wxml的style参数中修改元素显示样式,也可在wxss文件定义样式。 

更多内容欢迎关注博主。

有用的话欢迎打赏。

 

http://www.zhongyajixie.com/news/56539.html

相关文章:

  • 中国旅游电子商务网站建设情况策划方案模板
  • 起飞页做网站步骤logo网站设计
  • 同ip多域名做同行业网站企业seo关键词优化
  • 做的网站空白了深圳网络营销
  • 长沙微信营销公司江苏搜索引擎优化
  • php网站源码架构seo是什么意思 为什么要做seo
  • 上海网站建设找缘魁免费信息发布平台网站
  • 如何做网站主页seo服务 文库
  • 企业建站一条龙官网seo哪家公司好
  • 佛山小企业网站建设2021年网络营销考试题及答案
  • 榆林市 网站建设买淘宝店铺多少钱一个
  • diy网站源码百度推广的五大优势
  • 进入网站后台管理系统360竞价推广登录入口
  • wordpress支持的语言包搜索引擎关键词优化
  • 对网站建设的认识百度网盘网页版登录入口官网
  • 特产网站源码深圳网络推广公司
  • 电商模板下载的网站chrome网页版入口
  • 盐步网站制作网上推广
  • 日本做仿牌网站黄页网站推广公司
  • 河北邢台福州seo顾问
  • 360网站seo手机优化软件黄页网推广服务
  • 政府网站集约化建设的目的济南疫情最新消息
  • it之家网站源码如何免费注册一个网站
  • github 做自己的网站网络推广公司名字大全
  • 湛江住房和城乡建设部网站外链在线发布工具
  • 金融网站开发方案如何分析百度指数
  • wordpress 评论 模块seo网站推广方案
  • 那家b2c网站建设报价淄博seo
  • dremwear做网站网络公司网站
  • 体育彩票网站开发方案澎湃新闻