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

你可能感兴趣的文章
windowsXP用户被禁用导致不能网站登录
查看>>
第 8 章 TokyoCabinet/Tyrant
查看>>
智慧城市逐步推进 未来城市建设突破口分析
查看>>
是谁在推动路由器智能连接功能的普及?
查看>>
物联网软件更新政策不明 智能冰箱也易沦为犯罪工具
查看>>
基于 SaaS 解决库存问题, Nextail 获 160 万美元融资
查看>>
中昌海运拟更名“中昌大数据股份有限公司”
查看>>
Windows 10新版可以更新了!这些新功能值得升级
查看>>
《微信公众平台开发最佳实践》——2.2 微信开发者中心
查看>>
《IPv6精髓(第2版)》——1.4 常见误解
查看>>
《精通ArcGIS Server 应用与开发》——2.2 ArcGIS Server架构
查看>>
《UNIX网络编程 卷1:套接字联网API(第3版)》——2.10 TCP端口号与并发服务器...
查看>>
Centrifugo —— 用 Golang 实现的实时消息通信平台
查看>>
《善用佳软:高效能人士的软件应用之道》一2.6 小工具之计算器
查看>>
《Web前端工程师修炼之道(原书第4版)》——关于浏览器
查看>>
关于CKEditor4.5.6的使用,自定义toolbar配置,上传图片案例(SpringMVC+MyBatis案例),自定义行高,去编辑器的中内容,将编辑器中内容设置到指定的位置等...
查看>>
Ejoy2D —— 来自云风的开源游戏图形引擎
查看>>
Linux主机肉鸡木马minerd导致CPU跑满
查看>>
Organelle —— 支持编程的智能音频设备,能玩!
查看>>
phpMyAdmin 4.0.0-rc4 发布
查看>>