css3滚动边框特效属性 filter、inset应用

复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="main">
			<div class="border" style="--border-color:hsl(120, 86%, 53%); --delay-coef:2">
				<div class="text">

				</div>
			</div>
		</div>
		<style type="text/css">
			body {
				--border-color: hsl(295, 100%, 63%);
				--border-gradient-angle: 0turn;
				--button-bgc: #ff7300;
				--font-color: hsl(0, 0%, 100%);
				--body-bgc: hsl(230, 50%, 15%);
				background-color: var(--body-bgc);
			}

			* {
				padding: 0;
				margin: 0;
			}

			#main {
				display: flex;
				justify-content: center;
				align-items: center;
				padding-top: 100px;





			}

			/* 内部文字 */
			.border .text {
				font-size: 2rem;
				letter-spacing: .1em;
				text-transform: uppercase;
				color: var(--font-color);
				opacity: 0.6;
				position: relative;
				z-index: 1;
			}

			.border {
				display: flex;
				justify-content: center;
				align-items: center;
				text-decoration: none;
				padding: 0.8em 1em;
				background-color: var(--button-bgc);
				overflow: hidden;
				position: relative;
				width: 200px;
				height: 100px;
			}

			@keyframes animate {
				0% {
					/* transform: rotate(calc(30deg * var(--delay-coef))) */
					transform: rotate(calc(0))
				}

				100% {
					/* transform: rotate(calc(360deg + 30deg * var(--delay-coef))) */
					transform: rotate(calc(360deg))
				}

			}

			.border::after {
				content: "";
				position: absolute;
				background-color: var(--button-bgc);
				inset: 4px;
			}

			/* .border::after, */
			.border::before {
				content: '';
				position: absolute;
				height: 80%;
				width: 150%;
				background-color: var(--border-color);
				animation: animate 3s linear infinite;

			}
		</style>
	
		<p>测试彩色</p>
		<div class="sb">
			<div class="sb2">
				娃哈哈
			</div>
		</div>
		<p>裁剪</p>
		<div class="shuaibu2">
			<div class="shuaibi"></div>
		</div>
		<style type="text/css">
			.sb{
				display: flex;
				justify-content: center;
				align-items: center;
			
			}
			.sb2{
				width: 200px;
				height: 100px;
				 background: linear-gradient(45deg, #ffadad, #ffd65a, #fdffb6, #9bf6ff, #10c4ff, #bdb2ff, #ffc626);
				position: relative;
				overflow: hidden;
				background-clip: text;
				  -webkit-text-fill-color: transparent;
			}
			@keyframes animate1 {
				0% {
				
					transform: rotate(0);
					filter: hue-rotate(0deg);
				}
			
				100% {
					
					transform: rotate(360deg);
					 filter: hue-rotate(360deg);
				}
			
			}
			.sb2::before{
				content: "";
				width: 150%;
				height: 80%;
				position: absolute;
				background-color: red;
				animation: animate1 3s linear infinite;
				transfrom-origin:left bottom;
			}
			.sb2::after{
				content: "";
				position: absolute;
				background-color: blue;
				inset: 4px;
			}
			
			/* 裁剪测试 */
			.shuaibu2{
				width: 300px;
				height: 100px;
				background-color: red;
				position: relative;
			}
			.shuaibi{
				position: absolute;
				background-color: blue;
				inset: 4px;
			}
		</style>
	</body>
</html>


相关推荐
张3蜂14 小时前
Python 四大 Web 框架对比解析:FastAPI、Django、Flask 与 Tornado
前端·python·fastapi
南风知我意95714 小时前
【前端面试5】手写Function原型方法
前端·面试·职场和发展
qq_124987075314 小时前
基于Java Web的城市花园小区维修管理系统的设计与实现(源码+论文+部署+安装)
java·开发语言·前端·spring boot·spring·毕业设计·计算机毕业设计
小安驾到14 小时前
【前端的坑】vxe-grid表格tooltip提示框不显示bug
前端·vue.js
去码头整点薯条9814 小时前
python第五次作业
linux·前端·python
沐墨染15 小时前
Vue实战:自动化研判报告组件的设计与实现
前端·javascript·信息可视化·数据分析·自动化·vue
局外人LZ15 小时前
Uniapp脚手架项目搭建,uniapp+vue3+uView pro+vite+pinia+sass
前端·uni-app·sass
爱上妖精的尾巴16 小时前
8-5 WPS JS宏 match、search、replace、split支持正则表达式的字符串函数
开发语言·前端·javascript·wps·jsa
为什么不问问神奇的海螺呢丶16 小时前
n9e categraf redis监控配置
前端·redis·bootstrap
云飞云共享云桌面16 小时前
推荐一些适合10个SolidWorks设计共享算力的服务器硬件配置
运维·服务器·前端·数据库·人工智能