博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
css3 背景色 实现边框渐变运动动画
阅读量:6865 次
发布时间:2019-06-26

本文共 8819 字,大约阅读时间需要 29 分钟。

css3

#body_id {
animation: myfirst 10s ease-in-out -2s infinite alternate; /* Firefox: */ -moz-animation: myfirst 10s ease-in-out -2s infinite alternate; /* Safari 和 Chrome: */ -webkit-animation: myfirst 10s ease-in-out -2s infinite alternate; /* Opera: */ -o-animation: myfirst 10s ease-in-out -2s infinite alternate; height: 51px; } .mui-bar {
-webkit-box-shadow: none; box-shadow: none; background: #FFFFFF; height: 50px; } @keyframes myfirst {
0% { background: -moz-linear-gradient(left, red, #f96, yellow, green, #ace); background: -webkit-linear-gradient(left, red, #f96, yellow, green, #ace); background: -o-linear-gradient(left, red, #f96, yellow, green, #ace); background: linear-gradient(left, red, #f96, yellow, green, #ace); } 25% {
background: -moz-linear-gradient(left, #ace, red, #f96, yellow, green); background: -webkit-linear-gradient(left, #ace, red, #f96, yellow, green); background: -o-linear-gradient(left, #ace, red, #f96, yellow, green); background: linear-gradient(left, #ace, red, #f96, yellow, green); } 50% {
background: -moz-linear-gradient(left, green, #ace, red, #f96, yellow); background: -webkit-linear-gradient(left, green, #ace, red, #f96, yellow); background: -o-linear-gradient(left, green, #ace, red, #f96, yellow); background: linear-gradient(left, green, #ace, red, #f96, yellow); } 75% {
background: -moz-linear-gradient(left, yellow, green, #ace, red, #f96); background: -webkit-linear-gradient(left, yellow, green, #ace, red, #f96); background: -o-linear-gradient(left, yellow, green, #ace, red, #f96); background: linear-gradient(left, yellow, green, #ace, red, #f96); } 100% {
background: -moz-linear-gradient(left, #f96, yellow, green, #ace, red); background: -webkit-linear-gradient(left, #f96, yellow, green, #ace, red); background: -o-linear-gradient(left, #f96, yellow, green, #ace, red); background: linear-gradient(left, #f96, yellow, green, #ace, red); } } @-moz-keyframes myfirst /* Firefox */ {
0% { background: -moz-linear-gradient(left, red, #f96, yellow, green, #ace); } 25% {
background: -moz-linear-gradient(left, #ace, red, #f96, yellow, green); } 50% {
background: -moz-linear-gradient(left, green, #ace, red, #f96, yellow); } 75% {
background: -moz-linear-gradient(left, yellow, green, #ace, red, #f96); } 100% {
background: -moz-linear-gradient(left, #f96, yellow, green, #ace, red); } } @-webkit-keyframes myfirst /* Safari 和 Chrome */ {
0% { background: -webkit-linear-gradient(left, red, #f96, yellow, green, #ace); } 25% {
background: -webkit-linear-gradient(left, #ace, red, #f96, yellow, green); } 50% {
background: -webkit-linear-gradient(left, green, #ace, red, #f96, yellow); } 75% {
background: -webkit-linear-gradient(left, yellow, green, #ace, red, #f96); } 100% {
background: -webkit-linear-gradient(left, #f96, yellow, green, #ace, red); } } @-o-keyframes myfirst /* Opera */ {
0% { background: -o-linear-gradient(left, red, #f96, yellow, green, #ace); } 25% {
background: -o-linear-gradient(left, #ace, red, #f96, yellow, green); } 50% {
background: -o-linear-gradient(left, green, #ace, red, #f96, yellow); } 75% {
background: -o-linear-gradient(left, yellow, green, #ace, red, #f96); } 100% {
background: -o-linear-gradient(left, #f96, yellow, green, #ace, red); } }

html

 当然也可以这么写,运动更流畅

#body_id {
background: -moz-linear-gradient(left, red, #f96, yellow, green, #ace, red, #f96, yellow, green, #ace); background: -webkit-linear-gradient(left, red, #f96, yellow, green, #ace, red, #f96, yellow, green, #ace); background: -o-linear-gradient(left, red, #f96, yellow, green, #ace, red, #f96, yellow, green, #ace); background: linear-gradient(left, red, #f96, yellow, green, #ace, red, #f96, yellow, green, #ace); animation: myfirst 10s ease-in-out -2s infinite alternate; /* Firefox: */ -moz-animation: myfirst 10s ease-in-out -2s infinite alternate; /* Safari 和 Chrome: */ -webkit-animation: myfirst 10s ease-in-out -2s infinite alternate; /* Opera: */ -o-animation: myfirst 10s ease-in-out -2s infinite alternate; height: 51px; width: 150%; overflow: hidden; } .mui-bar {
-webkit-box-shadow: none; box-shadow: none; background: #FFFFFF; height: 50px; } @keyframes myfirst {
0% { bottom:0 ;left: -50%; } 25% {
bottom:0 ;left: 0%; } 50% {
bottom:0 ;left: -50%; } 75% {
bottom:0 ;left: 0%; } 100% {
bottom:0 ;left: -50%; } } @-moz-keyframes myfirst /* Firefox */ {
0% { bottom:0 ;left: -50%; } 25% {
bottom:0 ;left: 0%; } 50% {
bottom:0 ;left: -50%; } 75% {
bottom:0 ;left: 0%; } 100% {
bottom:0 ;left: -50%; } } @-webkit-keyframes myfirst /* Safari 和 Chrome */ {
0% { bottom:0 ;left: -50%; } 25% {
bottom:0 ;left: 0%; } 50% {
bottom:0 ;left: -50%; } 75% {
bottom:0 ;left: 0%; } 100% {
bottom:0 ;left: -50%; } } @-o-keyframes myfirst /* Opera */ {
0% { bottom:0 ;left: -50%; } 25% {
bottom:0 ;left: 0%; } 50% {
bottom:0 ;left: -50%; } 75% {
bottom:0 ;left: 0%; } 100% {
bottom:0 ;left: -50%; } }

 

转载于:https://www.cnblogs.com/hiit/p/5694842.html

你可能感兴趣的文章
安全狗服云web端V3.4(企业服务)版上线
查看>>
在Android Library的Module中按渠道依赖
查看>>
对javascript匿名函数的理解(透彻版)
查看>>
使用virtualbox安装centos6的内置无线网卡桥接设置
查看>>
java调用http接口(HttpURLConnection的使用)
查看>>
java代码内,获得jsp产生的html
查看>>
jquery.validate remote 和 自定义验证方法
查看>>
hibernate使用sql查询
查看>>
二叉树(2)——遍历的非递归实现
查看>>
OS X 键盘快捷键
查看>>
linux下vi命令大全
查看>>
设计模式之四:访问者模式
查看>>
加密和解密
查看>>
python使用.proto文件生成service接口失败
查看>>
判断矩形是否在矩形中
查看>>
关于composer.json中require-dev和require-dev、autoload-dev和autoload的区别
查看>>
Android自定义权限
查看>>
实用Linux命令集锦(一)
查看>>
小程序实现瀑布流
查看>>
https详解小白入门版(4)-SSL协议详解(转)
查看>>