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

你可能感兴趣的文章
jquery
查看>>
伏地魔
查看>>
linux
查看>>
安装虚拟机-linux系统步骤
查看>>
集训第五周动态规划 J题 括号匹配
查看>>
微信小程序车牌键盘
查看>>
python 网络编程
查看>>
【BZOJ】2165: 大楼
查看>>
【BZOJ】2442: [Usaco2011 Open]修剪草坪
查看>>
2分钟读懂UML
查看>>
Curso de FP Interpretacion Lenguaje de Signos a distancia.
查看>>
HTML图像
查看>>
类和对象简析
查看>>
深入Java集合学习系列:LinkedHashSet的实现原理
查看>>
zlog学习笔记(zc_hashtable)
查看>>
Java读取lob格式数据
查看>>
linux之列出目录
查看>>
第十三章、学习 Shell Scripts 条件判断式
查看>>
zzzzz 排序总结
查看>>
php 基础语法
查看>>