JSFiddle - React, Tailwind, and code Playground
by Roger Sanchez
HTML
<div class="box">
</div>
SCSS
body {background:#fff}
.box,
.box::before,
.box::after {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.box {
width: 300px;
height: 77px;
margin: auto;
/*
box-shadow: inset 0 0 0 1px rgba(105, 202, 98, 0.5);
*/
--borderWidth: 3px;
background-color: #fff2cd;
border-radius: var(--borderWidth);
}
.box::before,
.box::after {
content: '';
z-index: -1;
margin: -2%;
/*box-shadow: inset 0 0 0 2px;*/
//animation: clipMe 4s linear infinite;
position: absolute;
/*
top: calc(-1 * var(--borderWidth));
left: calc(-1 * var(--borderWidth));
height: calc(100% + var(--borderWidth) * 2);
width: calc(100% + var(--borderWidth) * 2);
border-radius: calc(2 * var(--borderWidth));
*/
background: linear-gradient(60deg, #f79533, #f3d355, #ffeb94, #f7b600, #fffb0f, #eab80e, #f3da26, #f7a510);
z-index: -1;
animation: animatedgradient 3s ease alternate infinite;
background-size: 300% 300%;
}
.box::before {
animation-delay: -2s;
}
@keyframes animatedgradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
@keyframes clipMe {
0%, 100% { clip: rect(0px, 340px, 2px, 0px); }
25% { clip: rect(0px, 2px, 340px, 0px); }
50% { clip: rect(150px, 340px, 340px, 0px); }
75% { clip: rect(0px, 340px, 340px, 150px);}
}