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

你可能感兴趣的文章
084:QuerySet API详解prefetch_related方法
查看>>
递归函数
查看>>
C语言宏中"#"和"##"的用法
查看>>
亲测PHpnow 安装环境
查看>>
JavaScript 使用random()在一个范围内生成随机数
查看>>
你真的会玩SQL吗?Case也疯狂
查看>>
connectionstrings-sql server 2012
查看>>
Ubuntu中搭建Hadoop2.5.2完全分布式系统(二)
查看>>
码农最艰巨的十大任务
查看>>
第一次校赛总结
查看>>
二进制反码求和
查看>>
[Jxoi2012]奇怪的道路 BZOJ3195 状压DP
查看>>
写一个字符串反转函数,实现字符串倒序。
查看>>
10.scrapy框架简介和基础应用
查看>>
[转]RGB颜色查询对照表
查看>>
进制转换的知识
查看>>
9月28日学习内容整理:多进程,并发,子进程的创建(multiprocessing模块)
查看>>
3月8日学习内容整理:restframework的视图组件
查看>>
《结对-贪吃蛇游戏-开发环境搭建过程》
查看>>
OO第四阶段总结
查看>>