当前位置:   article > 正文

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

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

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

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

(一)样式图


 

(二)代码部分

2.1:wxml

  1. <!-- --------------------------【序号003:瓷片区+弥散渐变】----------------------------------- -->
  2. <view style="height: 50rpx;background-color: #FFA07A;"><text>序号003:瓷片区+弥散渐变</text></view>
  3. <view class="tile-container">
  4. <view class="tile" style="background: linear-gradient(to right, #ffcccc, #ccffff);"></view>
  5. <view class="tile" style="background: linear-gradient(to right, #ccffcc, #99ccff);"></view>
  6. <view class="tile" style="background: linear-gradient(to right, #ffcc99, #ccffff);"></view>
  7. <view class="tile" style="background: linear-gradient(to right, #FFD3B5, #FFB78C);"></view>
  8. <view class="tile" style="background: linear-gradient(to right, #9AD7E9, #B5E2FF);"></view>
  9. <view class="tile" style="background: linear-gradient(to right, #B4EDB9, #E0F9E0);"></view>
  10. </view>
  11. <!-- --------------------------【序号002:瓷片区+内容】----------------------------------- -->
  12. <view style="height: 50rpx;background-color: #FFA07A;"><text>序号002:瓷片区+内容</text></view>
  13. <view class="main-container2">
  14. <view class="left-area2">
  15. <view class="left-tile2" style="background-color: #FFD700;">
  16. <view class="left-content2-1">
  17. <text class="title2">这是顶部标题</text>
  18. <text class="subtitle2">这是小标题</text>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="right-area2">
  23. <view class="right-top-tile2" style="background-color: #98FB98;">
  24. <view class="left-content2-2">
  25. <text class="title2">这是顶部标题</text>
  26. <text class="subtitle2">这是小标题</text>
  27. </view>
  28. </view>
  29. <view class="right-bottom-tile2" style="background-color: #FFB6C1;">
  30. <view class="left-content2-3">
  31. <text class="title2">这是顶部标题</text>
  32. <text class="subtitle2">这是小标题</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- --------------------------【序号001:瓷片区】----------------------------------- -->
  38. <view style="height: 50rpx;background-color: #FFA07A;"><text>序号001:瓷片区</text></view>
  39. <view class="main-container1">
  40. <view class="left-area1">
  41. <view class="left-tile1" style="background-color: #FFD700;"></view>
  42. </view>
  43. <view class="right-area1">
  44. <view class="right-top-tile1" style="background-color: #98FB98;"></view>
  45. <view class="right-bottom-tile1" style="background-color: #FFB6C1;"></view>
  46. </view>
  47. </view>
  48. <!-- --------------------------【序号000:瓷片区】----------------------------------- -->
  49. <view style="height: 50rpx;background-color: #FFA07A;"><text>序号000:瓷片区</text></view>
  50. <view class="main-container">
  51. <view class="left-area">
  52. <view class="left-tile" style="background-color: #FFD700;"></view>
  53. </view>
  54. <view class="middle-area">
  55. <view class="middle-top-tile" style="background-color: #ADD8E6;"></view>
  56. <view class="middle-bottom-tile" style="background-color: #FFA07A;"></view>
  57. </view>
  58. <view class="right-area">
  59. <view class="right-top-tile" style="background-color: #98FB98;"></view>
  60. <view class="right-bottom-tile" style="background-color: #FFB6C1;"></view>
  61. </view>
  62. </view>

 

2.2:wxss代码

  1. /* --------------------------【序号003:瓷片区+弥散渐变】----------------------------------- */
  2. .tile-container {
  3. display: flex;
  4. flex-wrap: wrap;
  5. justify-content: space-between;
  6. align-content: space-between;
  7. width: 100%;
  8. height: 120px; /* 设置瓷片区的高度 */
  9. background-color: #D3D3D3;
  10. /* 设置浅灰色背景色 */
  11. margin-bottom: 10px;
  12. }
  13. .tile {
  14. width: 30%; /* 设置每个瓷片的宽度 */
  15. height: 44%; /* 设置每个瓷片的高度 */
  16. margin-top: 2%;
  17. }
  18. /* --------------------------【序号002:瓷片区+内容】----------------------------------- */
  19. .main-container2 {
  20. display: flex;
  21. justify-content: space-between;
  22. align-items: stretch;
  23. padding-bottom: 10rpx;
  24. height: 300rpx;
  25. /* 设置整个布局的高度 */
  26. background-color: #D3D3D3;
  27. /* 设置浅灰色背景色 */
  28. margin-bottom: 10px;
  29. }
  30. .left-area2 {
  31. width: 43%;
  32. }
  33. .right-area2 {
  34. width: 55%;
  35. }
  36. .left-tile2 {
  37. height: 100%;
  38. padding-bottom: 10rpx;
  39. margin-left: 20rpx;
  40. }
  41. .right-top-tile2,
  42. .right-bottom-tile2 {
  43. height: 50%;
  44. /* 设置瓷砖高度,左侧和中间右侧一样高 */
  45. }
  46. .right-bottom-tile2 {
  47. margin-top: 10rpx;
  48. /* 设置瓷砖高度,左侧和中间右侧一样高 */
  49. }
  50. .right-top-tile2,
  51. .right-bottom-tile2 {
  52. margin-right: 20rpx;
  53. }
  54. /* ---瓷片区里面的内容--- */
  55. .left-content2-1,
  56. .left-content2-2,
  57. .left-content2-3 {
  58. display: flex;
  59. flex-direction: column;
  60. align-items: center;
  61. /* 水平居中 */
  62. height: 100%;
  63. }
  64. .left-content2-1 {
  65. justify-content: center;
  66. /* 垂直居中 */
  67. }
  68. .left-content2-2 {
  69. justify-content: flex-start;
  70. /* 垂直居上 */
  71. }
  72. .left-content2-3 {
  73. justify-content: flex-end;
  74. /* 垂直居上 */
  75. }
  76. .title2 {
  77. font-size: 35rpx;
  78. /* 或其他您喜欢的尺寸 */
  79. font-weight: bold;
  80. color: #000000;
  81. /* 黑色 */
  82. margin-bottom: 5rpx;
  83. /* 调整标题和副标题的间距 */
  84. }
  85. .subtitle2 {
  86. font-size: 25rpx;
  87. /* 或其他您喜欢的尺寸 */
  88. color: #808080;
  89. /* 灰色 */
  90. }
  91. .image2 {
  92. width: 100%;
  93. height: auto;
  94. margin-top: 10rpx;
  95. }
  96. /* --------------------------【序号001:瓷片区+3个】----------------------------------- */
  97. .main-container1 {
  98. display: flex;
  99. justify-content: space-between;
  100. align-items: stretch;
  101. padding-bottom: 10rpx;
  102. height: 300rpx;
  103. /* 设置整个布局的高度 */
  104. background-color: #D3D3D3;
  105. /* 设置浅灰色背景色 */
  106. margin-bottom: 10px;
  107. }
  108. .left-area1 {
  109. width: 43%;
  110. }
  111. .right-area1 {
  112. width: 55%;
  113. }
  114. .left-tile1 {
  115. height: 100%;
  116. padding-bottom: 10rpx;
  117. margin-left: 20rpx;
  118. }
  119. .right-top-tile1,
  120. .right-bottom-tile1 {
  121. height: 50%;
  122. /* 设置瓷砖高度,左侧和中间右侧一样高 */
  123. }
  124. .right-bottom-tile1 {
  125. margin-top: 10rpx;
  126. /* 设置瓷砖高度,左侧和中间右侧一样高 */
  127. }
  128. .right-top-tile1,
  129. .right-bottom-tile1 {
  130. margin-right: 20rpx;
  131. }
  132. /* --------------------------【序号000:瓷片区+5个】----------------------------------- */
  133. .main-container {
  134. display: flex;
  135. justify-content: space-between;
  136. align-items: stretch;
  137. padding-bottom: 10rpx;
  138. height: 300rpx;
  139. /* 设置整个布局的高度 */
  140. background-color: #D3D3D3;
  141. /* 设置浅灰色背景色 */
  142. margin-bottom: 10px;
  143. }
  144. .left-area,
  145. .middle-area,
  146. .right-area {
  147. width: 32%;
  148. /* 设置左、中、右区域宽度 */
  149. }
  150. .left-tile {
  151. height: 100%;
  152. /* 设置瓷砖高度,左侧和中间右侧一样高 */
  153. padding-bottom: 10rpx;
  154. margin-left: 10rpx;
  155. }
  156. .middle-top-tile,
  157. .middle-bottom-tile,
  158. .right-top-tile,
  159. .right-bottom-tile {
  160. height: 50%;
  161. /* 设置瓷砖高度,左侧和中间右侧一样高 */
  162. }
  163. .middle-bottom-tile,
  164. .right-bottom-tile {
  165. margin-top: 10rpx;
  166. /* 设置瓷砖高度,左侧和中间右侧一样高 */
  167. }
  168. .right-top-tile,
  169. .right-bottom-tile {
  170. margin-right: 10rpx;
  171. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/859988
推荐阅读
相关标签
  

闽ICP备14008679号