如何在css中使进度条的角落变圆 [英] How to make corners of progress bar round in css

查看:52
本文介绍了如何在css中使进度条的角落变圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的进度条,我希望使边缘变圆,并在进度条中显示百分比.我设法使进度值的角是圆的,但不是条形/背景.而且动画似乎不起作用.

For my progress bar I would like to have the edges rounded and the percentage on display inside the progress bar. I managed to get the corners of the progress value to be round but not the bar/background. Also the animation doesn't seem to work.

〜css

.progress-bar body { 
font-family: "Helvetica Neue", arial, sans-serif;
padding: 2em;
margin: 50px auto 0;
max-width: 800px;
border-radius: 15px;
-moz-border-radius: 15px;
}


.progress-bar .skill h3 { 
font-size: 1em; 
color: #fff;
left: 1em;
line-height: 1;
position: absolute;
top:1em;

}

progress { border-radius:15px; -moz-border-radius: 15px;}

.progress-bar progress, progress[role] {
-webkit-appearance: none;
-moz-appearance: none;
 appearance: none;
 background-size: auto;
 height: 50px;
 width: 100%;
 border-radius: 15px;
 -moz-border-radius: 15px;
 }



  .progress-bar .skill-list {
   list-style-type: none;
   margin: 0;
   padding: 1em;

   }

   .progress-bar .skill {
    margin-bottom: 1em;
    position: relative;
    list-style-type: none;

    }

    .progress-bar .skill ::-webkit-progress-value { 
    -webkit-animation: bar-fill 2s;
    width: 0px;
    -moz-border-radius: 15px;
    border-radius: 15px;
     }



     .progress-bar .skill-1::-webkit-progress-value {
     background: #ff9e2c;
     border-radius: 15px;
     -moz-border-radius: 15px;
     }

 .progress-bar .skill-1::-moz-progress-bar {
    background: #ff9e2c;
   border-radius: 15px;
   -moz-border-radius: 15px;
   }

  .progress-bar .skill-2::-webkit-progress-value {
  background: #4ecdc4;
  border-radius: 15px;
   -moz-border-radius: 15px;
  }

 .progress-bar .skill-2::-moz-progress-bar {
  background: #4ecdc4;
  border-radius: 15px;
 -moz-border-radius: 15px;
 }

 .progress-bar .skill-3::-webkit-progress-value {
 background: #ff6b6b;
 border-radius: 15px;
 -moz-border-radius: 15px;
 }

.progress-bar .skill-3::-moz-progress-bar {
 background: #ff6b6b;
 border-radius: 15px;
 -moz-border-radius: 15px;
 }




 @-webkit-keyframes bar-fill {
  0% { width: 0; }
 }
 @keyframes bar-fill {
 0% { width: 0; }
 }

〜html

<div class="progress-bar">
<body>
<ul class="skill-list">
  <li class="skill">
    <h3>HTML/CSS</h3>
    <progress class="skill-1" max="100" value="80">
      <h2>80%</h2>
    </progress>
  </li>
  <li class="skill">
    <h3>Javascript</h3>
    <progress class="skill-2" max="100" value="45">
     <h2>45%</h2>
    </progress>
  </li>
  <li class="skill">
    <h3>PHP</h3>
    <progress class="skill-3" max="100" value="35">
      <h2>35%</h2>
    </progress>
  </li>
</ul>
</body>
</div>

推荐答案

我建议您可以使用引导程序来显示进度条.

I suggest you could use bootstrap for progress bars.

<div class="progress">
  <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="40"
  aria-valuemin="0" aria-valuemax="100" style="width:80%">
      HTML/CSS
  </div>
</div>
    <div class="progress">
  <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40"
  aria-valuemin="0" aria-valuemax="100" style="width:45%">
      JavaScript
  </div>
</div>
    <div class="progress">
  <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="40"
  aria-valuemin="0" aria-valuemax="100" style="width:35%">
      PHP
  </div>
</div>

看看这个小提琴.

http://jsfiddle.net/67ueLwgq/

这篇关于如何在css中使进度条的角落变圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆