进度条 箭头进度条的实现(伪元素的使用)

一.实现效果

进度条.gif

简易代码效果


进度条2.gif

二.完整代码

<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css3炫酷进度条动画|DEMO_jQuery之家-自由分享jQuery、html5、css3的插件库</title>
    <link href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
         .progress{
       height: 20px;
       background: #fff;
       border-radius:15px 0 0 15px;
       box-shadow:none;
       margin:20px 50px 40px 100px;
       overflow: visible;
       position: relative;
     }
     .progress .progress-title{
       position: absolute;
       left:-90px;
       font-size: 18px;
       font-weight: 700;
     }
     .progress .progress-value{
       position: absolute;
       right:-50px;
       font-size:18px;
       font-weight: 700;
       color:#205580;
     }
     .progress .progress-bar{
       background: #fff;
       box-shadow: none;
       border-radius:15px 0 0 15px;
       position: relative;
       -webkit-animation:animate-positive 2s;
       animation: animate-positive 2s;
     }
     .progress .progress-bar:before{
       content:"";
       position: absolute;
       top:-10px;
       right:-40px;
       border:20px solid transparent;
     }
     .pink .progress-bar:before{
       border-left:20px solid #ff4a98;
     }
     @-webkit-keyframes animate-positive{
            0% { width: 0; }
        }
        @keyframes animate-positive{
            0% { width: 0; }
        }
    </style>
</head>
<body>
  <div class="container">
    <div class="row text-center">
      <h1>进度条实例</h1>
    </div>
    <div class="row">
      <div class="progress pink">
        <div class="progress-title">HTML5</div>
        <div class="progress-value">90%</div>
        <div class="progress-bar" style="width:90%;background:linear-gradient(to right,#f791bd,#ff4a98);"></div>
      </div>
    </div>
  </div>
</body>
</html>

三.发现的问题

1.伪元素的使用

参考详细介绍的网址:https://www.cnblogs.com/ranzige/p/4554484.html

2.用伪元素实现三角形箭头
<html>
<head>
  <meta charset="utf-8" />
  <style>
    span{
      display: block;
      height: 30px;
      line-height: 30px;
      width:100px;
      text-align: center;
      background: #ccc;
      position: relative;
    }
    span::before{
      content:"";
      border:7px solid transparent;
      position: absolute;
      bottom:-14px;
      left:41px;
      border-top:7px solid red;
    }

  </style>
</head>
<body>
  <span>Hello world</span>
</body>
</html>
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML标准。 注意:讲述HT...
    kismetajun阅读 29,253评论 1赞 45
  • 1、通过CocoaPods安装项目名称项目信息 AFNetworking网络请求组件 FMDB本地数据库组件 SD...
    阳明AI阅读 16,424评论 3赞 119
  • 1.感恩美好的一天,早上吃到了这个地方的特产~米酒,很正宗的口味,谢谢,谢谢,谢谢。 2. 感恩今天找到一个电视剧...
    李洁Lee阅读 212评论 0赞 0
  • 今天在发呆的时候又想到一些可能性…有点失落,想想我们之间真的是不怎么可能,感觉你很讨厌我,从大一的寒假真的就可以看...
    驴_厮_命阅读 253评论 0赞 0
  • 我叫李东,在一家饮料公司工作,资深宅男一枚,工作呢就是平日里就研发各种口味的饮料,也配合生产车间进行辅料添加指导。...
    福仁缘的蓝胖子阅读 1,547评论 1赞 0

友情链接更多精彩内容