html进度条动画效果,CSS3创建时尚且具有动画效果的进度条

我们看到各种各样的进度条,这些进度条显示了流程的当前完成状态,例如下载或文件传输。无论是在构建桌面应用程序还是在构建Web应用程序,都可能需要使用此UI元素。

在本文中,将介绍如何使用CSS3创建时尚且具有动画效果的进度条。

f08280b6c827d602700b7350def72fff.gif

CSS3创建时尚且具有动画效果的进度条

进度条标记

标记很简单,代码如下:

解释.progress-bar -定义进度条的常规样式。

.blue-在这种情况下,.blue CSS类为进度栏添加了蓝色样式。

.stripes -当前进度栏的动画类型。

span-这将帮助您填充进度栏。内联集width将帮助您指定fill状态。

进度条CSS

CSS3进度栏和填充区域的常规样式:.progress-bar {

background-color: #1a1a1a;

height: 25px;

padding: 5px;

width: 350px;

margin: 50px 0;

border-radius: 5px;

box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;

}

.progress-bar span {

display: inline-block;

height: 100%;

border-radius: 3px;

box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;

transition: width .4s ease-in-out;

}

9aecb1bc9a5900d9a50210ee0f35da46.gif

我们添加一些颜色和渐变:.blue span {

background-color: #34c2e3;

}

.orange span {

background-color: #fecf23;

background-image: linear-gradient(top, #fecf23, #fd9215);

}

.green span {

background-color: #a5df41;

background-image: linear-gradient(top, #a5df41, #4ca916);

}

CSS渐变条纹.stripes span {

background-size: 30px 30px;

background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%,

transparent 25%,

transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,

transparent 75%, transparent);

animation: animate-stripes 3s linear infinite;

}

@keyframes animate-stripes {

0% {

background-position: 0 0;

}

100% {

background-position: 60px 0;

}

}

c061d6e4e8f5d51a84acf2fae6523f0e.gif

闪亮效果.shine span {

position: relative;

}

.shine span::after {

content: '';

opacity: 0;

position: absolute;

top: 0;

right: 0;

bottom: 0;

left: 0;

background: #fff;

border-radius: 3px;

animation: animate-shine 2s ease-out infinite;

}

@keyframes animate-shine {

0% {

opacity: 0;

width: 0;

}

50% {

opacity: .5;

}

100% {

opacity: 0;

width: 95%;

}

}

这个CSS3进度栏示例使用动画的CSS3 ::after 伪元素。

7935919d87536fba826f7d9fed78524c.gif

发光效果

基于box-shadow属性的CSS3关键帧动画:.glow span {

box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset,

0 -5px 5px rgba(255, 255, 255, .7) inset;

animation: animate-glow 1s ease-out infinite;

}

@keyframes animate-glow {

0% {

box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset,

0 -5px 5px rgba(255, 255, 255, .7) inset;

}

50% {

box-shadow: 0 5px 5px rgba(255, 255, 255, .3) inset,

0 -5px 5px rgba(255, 255, 255, .3) inset;

}

100% {

box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset,

0 -5px 5px rgba(255, 255, 255, .7) inset;

}

}

68808c712c9ca504efae5249e31e1592.gif

对于进一步的Web开发,要获得所需的结果,只需使用JavaScript或jQuery来更改这些进度条span的width值。

希望喜欢本教程。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值