当前位置:   article > 正文

css实现优惠券样式_css 优惠券

css 优惠券

实现优惠券效果:

实现思路:

  1. 需要三个盒子元素,使用 css 剪裁,利用 ellipse 属性,将两个盒子分别裁剪成两个半圆,位置固定在另一个盒子元素左右两边适当位置上。
  2. 为另一个盒子设置想要的样式,圆角、背景颜色和中间的横虚线等,此处使用的是 uView
  1. <template>
  2. <view class="pages">
  3. <view class="clip1" />
  4. <view class="clip2" />
  5. <view class="pageChild">
  6. <view class="header"/>
  7. <view class="line">
  8. <u-line dashed color="#fff" direction="row" length="96%" />
  9. </view>
  10. <view class="body"/>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {};
  18. },
  19. methods: {},
  20. };
  21. </script>
  22. <style scoped lang="scss">
  23. .pages {
  24. width: 95vw;
  25. position: relative;
  26. .clip1 {
  27. width: 100%;
  28. height: 100%;
  29. background-color: #fff;
  30. position: absolute;
  31. clip-path: ellipse(2% 6% at 0% 38%);
  32. }
  33. .clip2 {
  34. width: 100%;
  35. height: 100%;
  36. background-color: #fff;
  37. position: absolute;
  38. clip-path: ellipse(2% 6% at 100% 38%);
  39. }
  40. .pageChild {
  41. background-color: rgba($color: #ff0000, $alpha: 0.6);
  42. border-radius: 10rpx;
  43. .header {
  44. height: 85rpx;
  45. display: flex;
  46. justify-content:flex-start;
  47. align-items: center;
  48. }
  49. .line {
  50. display: flex;
  51. justify-content:center;
  52. align-items: center;
  53. }
  54. .body {
  55. height: 137rpx;
  56. display: flex;
  57. flex-direction: row;
  58. flex-wrap:wrap;
  59. }
  60. }
  61. }
  62. </style>
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/神奇cpp/article/detail/950828
推荐阅读
相关标签
  

闽ICP备14008679号