全栈开发技术分享
首页
👉 CSS大揭秘 👈
  • 目录
  • 分类
  • 标签
  • 归档
  • Vue
  • JavaScript
  • 微信开发
  • 移动端H5调试工具
  • 国内十大前端团队网站
  • Nodejs
  • Egg
  • 环境搭建
  • 运维面板
  • 域名配置
  • Nginx
  • 收藏
  • 常用工具
  • 实用技巧
  • 常用命令
  • 友情链接
关于

Dreaming Lee 🍍 ҉҉҉҉҉҉҉҉

开发小菜鸡
首页
👉 CSS大揭秘 👈
  • 目录
  • 分类
  • 标签
  • 归档
  • Vue
  • JavaScript
  • 微信开发
  • 移动端H5调试工具
  • 国内十大前端团队网站
  • Nodejs
  • Egg
  • 环境搭建
  • 运维面板
  • 域名配置
  • Nginx
  • 收藏
  • 常用工具
  • 实用技巧
  • 常用命令
  • 友情链接
关于
  • 边框

    • 1px边框
  • 视觉效果

    • 文字效果

      • 文字渐变色
      • 展示小于12px文字
      • 超出展示省略号
    • 进度条

      • 按钮进度条
  • 布局

    • 水平垂直居中
  • 动画

    • 小手动画
  • 其他

    • CSS设置滚动条样式
  • CSS
  • 视觉效果
  • 进度条
Dreaming Lee 🍍 ҉҉҉҉҉҉҉҉
2021-07-06

按钮进度条

原理:画两个大小一致的按钮进行叠加,上层按钮父级宽度设置为当前进度,超出隐藏。

正在下载…
正在下载…
正在下载…
正在下载…
<template>
  <div class="demo-ProgressButton">
    <div class="btn-container">
      <div class="btn">{{text}}</div>
      <div class="progress-container" style="width: 59%;">
        <div class="btn">{{text}}</div>
      </div>
    </div>
    <div class="btn-container">
      <div class="btn">{{text}}</div>
      <div class="progress-container animation">
        <div class="btn">{{text}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ProgressButton',
  data() {
    return {
      text: '正在下载…',
    }
  }
}
</script>

<style lang="scss">
.demo-ProgressButton {
  .btn-container {
    margin: 20px;
    position: relative;
    width: 288px;
    height: 44px;
  }
  .btn {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
		font-size: 22px;
		letter-spacing: 4px;
		font-weight: bold;
    background-color: rgba(#f2571e, .2);
    color: #f35a20;
  }
  .progress-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    overflow: hidden;
    z-index: 1;
    &.animation {
      transition: width 100ms linear;
      animation: widthProgress 2s linear infinite normal;
    }
    .btn {
      width: 288px;
      height: 44px;
      background-color: #f2571e;
      color: #fff;
    }
  }
  @keyframes widthProgress {
    to {
      width: 100%;
    }
  }
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
上次更新: 2021-07-08 10:53:30
超出展示省略号
水平垂直居中

← 超出展示省略号 水平垂直居中→

最近更新
01
【uniapp】字节小程序BUG - “navigateToMiniProgram/getUserProfile:fail must be invoked by user tap gesture”
06-21
02
七牛云上传自有证书
04-27
03
使用腾讯云申请免费SSL证书
04-27
更多文章>
Theme by Vdoing | Copyright © 2020-2024 | 豫ICP备2020030395号 | 靳立祥 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式