当前位置:首页 > 代码 > 正文

css条纹进度条代码(css制作进度条的原理)

admin 发布:2022-12-20 00:40 168


今天给各位分享css条纹进度条代码的知识,其中也会对css制作进度条的原理进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

html5 css3 怎么制作简单的进度条

HTML代码:

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制作进度条的简单示例代码

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制作进度条

条纹进度条

若要制作一个条纹进度条,我们应该把.bar-fill重新命名为.bar-fill-stripes。我们将使用backgrou-image属性里的 linear-gradient同时声明它的颜色。剩余的CSS3动画效果也是和上述相同,看下面的代码:

.bar-fill-stripes {

height:15px;

display:block;

background:#e74c3c;

width:0;

border-radius:8px;

background-image:linear-gradient(-45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);

-webkit-transition:width .8s ease;

-moz-transition:width .8s ease;

transition:width .8s ease;

-webkit-animation:progressbar 7s infinite;

animation:progressbar 7s infinite

}

css条纹进度条代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于css制作进度条的原理、css条纹进度条代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/32161.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载