博客
关于我
强烈建议你试试无所不能的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

你可能感兴趣的文章
TP中的模型关联的多对多关系
查看>>
linux-用户和组管理详解
查看>>
URL编码问题
查看>>
“Unable to open MKS: Internal Error” when opening virtual machine console
查看>>
span里float使用问题
查看>>
【Redis基本数据结构】字典实现 rehash介绍
查看>>
ISP_QoS 学习笔记 <不完整>
查看>>
Illegal Instruction错误小谈
查看>>
web基础
查看>>
安装inotify和对应inotify命令操作,以及inotify和rsync的组合操作
查看>>
KVM虚拟化-qemu-kvm杂记
查看>>
常用的查看文件行数的命令,cat,wc,sed,awk,grep
查看>>
nginx日志统计分析
查看>>
03_02 bash 特性详解 (上)
查看>>
写给自己
查看>>
mysql日常问题处理
查看>>
电子邮件服务器安全
查看>>
磁盘管理介绍
查看>>
haproxy 安装部署文档
查看>>
CentOS6.4 KVM 虚拟机命令行安装配置
查看>>