《样式设计011:模组-瓷片区》

描述:在开发小程序过程中,发现一些不错的案例,平时使用也比较多,稍微总结了下经验,以下内容可以直接复制使用,希望对大家有所帮助,废话不多说直接上干货!

一、小程序:模组-瓷片区

(一)样式图


 

(二)代码部分

2.1:wxml



<!-- --------------------------【序号003:瓷片区+弥散渐变】----------------------------------- -->
<view style="height: 50rpx;background-color: #FFA07A;"><text>序号003:瓷片区+弥散渐变</text></view>
<view class="tile-container">
  <view class="tile" style="background: linear-gradient(to right, #ffcccc, #ccffff);"></view>
  <view class="tile" style="background: linear-gradient(to right, #ccffcc, #99ccff);"></view>
  <view class="tile" style="background: linear-gradient(to right, #ffcc99, #ccffff);"></view>
  <view class="tile" style="background: linear-gradient(to right, #FFD3B5, #FFB78C);"></view>
  <view class="tile" style="background: linear-gradient(to right, #9AD7E9, #B5E2FF);"></view>
  <view class="tile" style="background: linear-gradient(to right, #B4EDB9, #E0F9E0);"></view>
</view>

<!-- --------------------------【序号002:瓷片区+内容】----------------------------------- -->
<view style="height: 50rpx;background-color: #FFA07A;"><text>序号002:瓷片区+内容</text></view>
<view class="main-container2">
  <view class="left-area2">
    <view class="left-tile2" style="background-color: #FFD700;">
      <view class="left-content2-1">
        <text class="title2">这是顶部标题</text>
        <text class="subtitle2">这是小标题</text>
      </view>
    </view>
  </view>
  <view class="right-area2">
    <view class="right-top-tile2" style="background-color: #98FB98;">
      <view class="left-content2-2">
        <text class="title2">这是顶部标题</text>
        <text class="subtitle2">这是小标题</text>
      </view>
    </view>
    <view class="right-bottom-tile2" style="background-color: #FFB6C1;">
      <view class="left-content2-3">
        <text class="title2">这是顶部标题</text>
        <text class="subtitle2">这是小标题</text>
      </view>
    </view>
  </view>
</view>


<!-- --------------------------【序号001:瓷片区】----------------------------------- -->
<view style="height: 50rpx;background-color: #FFA07A;"><text>序号001:瓷片区</text></view>
<view class="main-container1">
  <view class="left-area1">
    <view class="left-tile1" style="background-color: #FFD700;"></view>
  </view>
  <view class="right-area1">
    <view class="right-top-tile1" style="background-color: #98FB98;"></view>
    <view class="right-bottom-tile1" style="background-color: #FFB6C1;"></view>
  </view>
</view>

<!-- --------------------------【序号000:瓷片区】----------------------------------- -->
<view style="height: 50rpx;background-color: #FFA07A;"><text>序号000:瓷片区</text></view>
<view class="main-container">
  <view class="left-area">
    <view class="left-tile" style="background-color: #FFD700;"></view>
  </view>
  <view class="middle-area">
    <view class="middle-top-tile" style="background-color: #ADD8E6;"></view>
    <view class="middle-bottom-tile" style="background-color: #FFA07A;"></view>
  </view>
  <view class="right-area">
    <view class="right-top-tile" style="background-color: #98FB98;"></view>
    <view class="right-bottom-tile" style="background-color: #FFB6C1;"></view>
  </view>
</view>

 

2.2:wxss代码


/* --------------------------【序号003:瓷片区+弥散渐变】----------------------------------- */
.tile-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: space-between;
  width: 100%;
  height: 120px; /* 设置瓷片区的高度 */
  background-color: #D3D3D3;
  /* 设置浅灰色背景色 */
  margin-bottom: 10px;
}

.tile {
  width: 30%; /* 设置每个瓷片的宽度 */
  height: 44%; /* 设置每个瓷片的高度 */
  margin-top: 2%;
}

/* --------------------------【序号002:瓷片区+内容】----------------------------------- */
.main-container2 {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding-bottom: 10rpx;
  height: 300rpx;
  /* 设置整个布局的高度 */
  background-color: #D3D3D3;
  /* 设置浅灰色背景色 */
  margin-bottom: 10px;
}

.left-area2 {
  width: 43%;
}

.right-area2 {
  width: 55%;
}

.left-tile2 {
  height: 100%;
  padding-bottom: 10rpx;
  margin-left: 20rpx;
}

.right-top-tile2,
.right-bottom-tile2 {
  height: 50%;
  /* 设置瓷砖高度,左侧和中间右侧一样高 */
}

.right-bottom-tile2 {
  margin-top: 10rpx;
  /* 设置瓷砖高度,左侧和中间右侧一样高 */
}

.right-top-tile2,
.right-bottom-tile2 {
  margin-right: 20rpx;
}

/* ---瓷片区里面的内容--- */
.left-content2-1,
.left-content2-2,
.left-content2-3 {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 水平居中 */
  height: 100%;
}

.left-content2-1 {
  justify-content: center; 
  /* 垂直居中 */
}
.left-content2-2 {
  justify-content: flex-start;
  /* 垂直居上 */
}
.left-content2-3 {
  justify-content: flex-end;
  /* 垂直居上 */
}




.title2 {
  font-size: 35rpx;
  /* 或其他您喜欢的尺寸 */
  font-weight: bold;
  color: #000000;
  /* 黑色 */
  margin-bottom: 5rpx;
  /* 调整标题和副标题的间距 */
}

.subtitle2 {
  font-size: 25rpx;
  /* 或其他您喜欢的尺寸 */
  color: #808080;
  /* 灰色 */
}

.image2 {
  width: 100%;
  height: auto;
  margin-top: 10rpx;
}


/* --------------------------【序号001:瓷片区+3个】----------------------------------- */
.main-container1 {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding-bottom: 10rpx;
  height: 300rpx;
  /* 设置整个布局的高度 */
  background-color: #D3D3D3;
  /* 设置浅灰色背景色 */
  margin-bottom: 10px;
}

.left-area1 {
  width: 43%;
}

.right-area1 {
  width: 55%;
}

.left-tile1 {
  height: 100%;
  padding-bottom: 10rpx;
  margin-left: 20rpx;
}

.right-top-tile1,
.right-bottom-tile1 {
  height: 50%;
  /* 设置瓷砖高度,左侧和中间右侧一样高 */
}

.right-bottom-tile1 {
  margin-top: 10rpx;
  /* 设置瓷砖高度,左侧和中间右侧一样高 */
}

.right-top-tile1,
.right-bottom-tile1 {
  margin-right: 20rpx;
}

/* --------------------------【序号000:瓷片区+5个】----------------------------------- */
.main-container {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding-bottom: 10rpx;
  height: 300rpx;
  /* 设置整个布局的高度 */
  background-color: #D3D3D3;
  /* 设置浅灰色背景色 */
  margin-bottom: 10px;
}

.left-area,
.middle-area,
.right-area {
  width: 32%;
  /* 设置左、中、右区域宽度 */
}

.left-tile {
  height: 100%;
  /* 设置瓷砖高度,左侧和中间右侧一样高 */
  padding-bottom: 10rpx;
  margin-left: 10rpx;
}

.middle-top-tile,
.middle-bottom-tile,
.right-top-tile,
.right-bottom-tile {
  height: 50%;
  /* 设置瓷砖高度,左侧和中间右侧一样高 */
}

.middle-bottom-tile,
.right-bottom-tile {
  margin-top: 10rpx;
  /* 设置瓷砖高度,左侧和中间右侧一样高 */
}

.right-top-tile,
.right-bottom-tile {
  margin-right: 10rpx;
}

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

大大大钢琴

开启一个愿望池,许下你愿望吧

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

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

打赏作者

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

抵扣说明:

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

余额充值