css3进度条样式,css制作进度条的原理

如何使用CSS3制作进度条的简单示例代码

p id="se_lev"安全级别 :span id="big"span id="min"/span/span高/p

创新互联公司是一家集网站建设,青阳企业网站建设,青阳品牌网站建设,网站定制,青阳网站建设报价,网络营销,网络优化,青阳网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

span#big { vertical-align:middle; display:inline-block; margin-left:6px; margin-right:20px; width:183px; height:14px; border:2px solid #a4a4a4; border-radius:14px; behavior: url(PIE.htc);}

span#min { display:block; height:100%; width:70%; background:#fe0002; border-top-left-radius:14px; border-bottom-left-radius:14px; behavior: url(PIE.htc);

原理:大盒子里套个小盒子,

大盒子给固定宽

小盒子的宽用%表示,(利用宽度的继承性,比如50%,就只有大盒一半宽)

这个css 里的50% 将来是要用来用js动态化的,一但动态起来,就达成了进度条的效果了

如何使用CSS3制作一个简单的进度条

如果不考虑IE的话,用css3应该不难:1、边框用背景图或纯色都可以,配合圆角和阴影;2、里面的进度条可以用垂直方向的线性渐变及阴影配合实现;3、最后配合js动态修改里面进度条div的宽度和文字的显示即可。

分享几种极具创意的HTML5/CSS3进度条特效

section class="container"

div class="progress"

span style="width: 20%;"span20%/span/span

/div

div class="progress"

span class="green" style="width: 40%;"span40%/span/span

/div

div class="progress"

span class="orange" style="width: 60%;"span60%/span/span

/div

div class="progress"

span class="red" style="width: 80%;"span80%/span/span

/div

div class="progress"

span class="blue" style="width: 100%;"span100%/span/span

/div

/section

从HTML结构中我们可以看出,类名为progress的div是整个进度条的父容器,里面的span则是当前进度,通过width来定义不同的进度值,同时定义不同的颜色类,比如orange,以便待会在CSS中进行样式渲染。

CSS代码:

.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%);

}


本文名称:css3进度条样式,css制作进度条的原理
文章链接:http://ybzwz.com/article/dsihdds.html