互补网网专做高品质CMS教程,所有教程均为站长亲测有效后发布。
您当前所在位置:互补网首页 > 站长学院 > DIV+CSS教程 >

html+css实现进度条效果(可用于柱形图)

发布时间:2021-10-20热度:0

最终效果展示:

image

html代码:

  <section class="container">
    <div class="progress">
      <span class="red" style="width: 60%;"><span>20%</span></span>
    </div>
    <div class="progress">
      <span class="blue" style="width: 40%;"><span>40%</span></span>
    </div>
    <div class="progress">
      <span class="orange" style="width: 60%;"><span>60%</span></span>
    </div>
    <div class="progress">
      <span style="width: 80%;"><span>80%</span></span>
    </div>
    <div class="progress">
      <span class="green" style="width: 100%;"><span>100%</span></span>
    </div>
  </section>

CSS代码:

html,body,div,span,applet,object,,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
margin:0;
padding:0;
border:0;
font-size:100%;
font:inherit;
vertical-align:baseline;
}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
display:block;
}
body {
line-height:1;
}
ol,ul {
list-style:none;
}
blockquote,q {
quotes:none;
}
blockquote:before,blockquote:after,q:before,q:after {
content:'';
content:none;
}
table {
border-collapse:collapse;
border-spacing:0;
}
.about {
margin:80px auto;
padding:8px;
width:260px;
font:10px/18px "Lucida Grande",Tahoma,Verdana,sans-serif;
color:#bbb;
text-align:center;
text-shadow:0 -1px rgba(0,0,0,0.3);
background:#333;
background:rgba(34,34,34,0.75);
border-radius:4px;
-webkit-box-shadow:inset 0 -1px rgba(0,0,0,0.1),inset 0 0 0 1px rgba(0,0,0,0.1),0 0 6px rgba(0,0,0,0.4);
box-shadow:inset 0 -1px rgba(0,0,0,0.1),inset 0 0 0 1px rgba(0,0,0,0.1),0 0 6px rgba(0,0,0,0.4);
background-image:-webkit-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2));
background-image:-moz-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2));
background-image:-o-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.2));
background-image:linear-gradient(to bottom,rgba(0,0,0,0),rgba(0,0,0,0.2));
}
.about a {
color:#eee;
text-decoration:none;
border-radius:2px;
-webkit-transition:0.1s;
-moz-transition:0.1s;
-o-transition:0.1s;
transition:0.1s;
}
.about a:hover {
text-decoration:none;
background:#555;
background:rgba(255,255,255,0.15);
}
.about-links {
height:30px;
}
.about-links a {
float:left;
width:50%;
line-height:30px;
font-size:12px;
}
.about-author {
margin-top:5px;
}
.about-author a {
padding:1px 3px;
margin:0 -1px;
}
/*
 * Copyright (c) 2012-2013 Thibaut Courouble
 */
.container {
margin:50px auto;
width:340px;
}
.container > div {
margin-bottom:20px;
}
.progress {
height:20px;
background:#ebebeb;
border-left:1px solid transparent;
border-right:1px solid transparent;
border-radius:10px;
}
.progress > span {
position:relative;
float:left;
margin:0 -1px;
min-width:30px;
height:18px;
line-height:16px;
text-align:right;
background:#cccccc;
border:1px solid;
border-color:#bfbfbf #b3b3b3 #9e9e9e;
border-radius:10px;
background-image:-webkit-linear-gradient(top,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
background-image:-moz-linear-gradient(top,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
background-image:-o-linear-gradient(top,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
background-image:linear-gradient(to bottom,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
-webkit-box-shadow:inset 0 1px rgba(255,255,255,0.3),0 1px 2px rgba(0,0,0,0.2);
box-shadow:inset 0 1px rgba(255,255,255,0.3),0 1px 2px rgba(0,0,0,0.2);
}
.progress > span > span {
padding:0 8px;
font-size:11px;
font-weight:bold;
color:#404040;
color:rgba(0,0,0,0.7);
text-shadow:0 1px rgba(255,255,255,0.4);
}
.progress > span:before {
content:'';
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
z-index:1;
height:18px;
background:url("../img/progress.png") 0 0 repeat-x;
border-radius:10px;
}
.progress .green {
background:#85c440;
border-color:#78b337 #6ba031 #568128;
background-image:-webkit-linear-gradient(top,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
background-image:-moz-linear-gradient(top,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
background-image:-o-linear-gradient(top,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
background-image:linear-gradient(to bottom,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
}
.progress .red {
background:#db3a27;
border-color:#c73321 #b12d1e #8e2418;
background-image:-webkit-linear-gradient(top,#ea8a7e 0%,#e15a4a 70%,#db3a27 100%);
background-image:-moz-linear-gradient(top,#ea8a7e 0%,#e15a4a 70%,#db3a27 100%);
background-image:-o-linear-gradient(top,#ea8a7e 0%,#e15a4a 70%,#db3a27 100%);
background-image:linear-gradient(to bottom,#ea8a7e 0%,#e15a4a 70%,#db3a27 100%);
}
.progress .orange {
background:#f2b63c;
border-color:#f0ad24 #eba310 #c5880d;
background-image:-webkit-linear-gradient(top,#f8da9c 0%,#f5c462 70%,#f2b63c 100%);
background-image:-moz-linear-gradient(top,#f8da9c 0%,#f5c462 70%,#f2b63c 100%);
background-image:-o-linear-gradient(top,#f8da9c 0%,#f5c462 70%,#f2b63c 100%);
background-image:linear-gradient(to bottom,#f8da9c 0%,#f5c462 70%,#f2b63c 100%);
}
.progress .blue {
background:#5aaadb;
border-color:#459fd6 #3094d2 #277db2;
background-image:-webkit-linear-gradient(top,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
background-image:-moz-linear-gradient(top,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
background-image:-o-linear-gradient(top,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
background-image:linear-gradient(to bottom,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
}


本文地址:http://www.25923.com/xuexi/divcss/1020171.html(转载请保留)