分享web开发知识

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

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

34.纯 CSS 创作在文本前后穿梭的边框

发布时间:2023-09-06 02:32责任编辑:郭大石关键词:CSS

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

感想: 动画  +  z-index:n   ;

HTML code:

<div class="warning">ERROR 404</div>

CSS code:

html, body { ???margin: 0; ???padding: 0; ???height: 100vh; ???display: flex; ???justify-content: center; ???align-items: center; ???background-color: rgb(20%, 20%, 20%);}.warning{ ???position: relative; ???padding: 0.6em 0.4em; ???/* border: 1px solid red; */ ???/* 定义文字样式 */ ???color: whitesmoke; ???font-size: 50px; ???font-family: sans-serif; ???font-weight: bold; ???z-index: 1;}/* 用伪元素定义边框尺寸 */.warning::before,.warning::after{ ???position: absolute; ???top: 0; ???left: 0; ???content: ‘‘; ???width: 100%; ???height: 100%; ???border: 0.2em solid transparent; ???box-sizing: border-box; ???color: orangered; ???animation: rotating 10s infinite;}@keyframes rotating{ ???to{ ???????transform: rotate(360deg); ???}}.warning::before{ ???border-top-color: currentColor; ???border-right-color: currentColor; ???/* 使其显示级数降级一点 */ ???z-index: -1;}.warning::after{ ???border-bottom-color: currentColor; ???border-left-color: currentColor; ???/* 加阴影 */ ???box-shadow: 0.3em 0.3em 0.3em rgba(20%, 20%, 20%, 0.8);}

34.纯 CSS 创作在文本前后穿梭的边框

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

知识推荐

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