分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

16.纯 CSS 创作一个渐变色动画边框

发布时间:2023-09-06 02:29责任编辑:顾先生关键词:CSS动画

原文地址:https://segmentfault.com/a/1190000014785816

感想:边框是伪元素::after来的;

HTML代码:

<div class="box"> ???you are my<br> ???FAVORIFE</div>

CSS代码:

html, body,.box { ???margin: 0; ???padding: 0; ???height: 100%; ???display: flex; ???justify-content: center; ???align-items: center;}body{ ???background: #222;}.box{ ???width: 10em; ???height: 5em; ???border-radius: 0.2em; ???line-height: 1.5em; ???font-size: 2.5em; ???/* 字体系列:无衬线;*/ ???font-family: sans-serif; ???color: white; ???background: #111; ???position: relative; ???animation: animate_text 2s linear infinite alternate;}@keyframes animate_text{ ???from{ ???????color: lime; ???} ???to{ ???????color: yellow; ???}}/* 用伪圆增加一个背板 */.box::after{ ???content: ‘‘; ???position: absolute; ???width: 102%; ???height: 104%; ???background-image: linear-gradient(60deg, aquamarine, cornflowerblue, goldenrod, hotpink, salmon, lightgreen, sandybrown, violet); ???background-size: 300%; ???border-radius: 0.2em; ???z-index: -1; ???animation: animate_bg 5s infinite;}@keyframes animate_bg{ ???0%{ ???????background-position: 0%, 50%; ???} ???50%{ ???????background-position: 100%, 50%; ???} ???100%{ ???????background-position: 0%, 50%; ???}}

16.纯 CSS 创作一个渐变色动画边框

原文地址:https://www.cnblogs.com/FlyingLiao/p/10241519.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved