need some fixes in the border animation

hey folks this is the CSS of my div
.celebrityNights {
display: flex;
flex-direction: column;
gap: 0.5rem;
text-align: center;
cursor: default;
padding: 1rem;
width: 30%;
position: relative;
}

.celebrityNights::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
height: 200%;
width: 200%;
background: conic-gradient(#4150d0, #4150d0), conic-gradient(#c850c0, #c850c0), conic-gradient(#4150d0, #4150d0), conic-gradient(#c850c0, #c850c0);
background-repeat: no-repeat;
background-size: 50% 50%, 50% 50%;
background-position: 0% 0%, 0% 100%, 100% 100%, 100% 0%;
animation: animate 4s linear infinite;
z-index: -1;
}

@keyframes animate {
100% {
transform: rotate(1turn);
}
}
.celebrityNights {
display: flex;
flex-direction: column;
gap: 0.5rem;
text-align: center;
cursor: default;
padding: 1rem;
width: 30%;
position: relative;
}

.celebrityNights::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
height: 200%;
width: 200%;
background: conic-gradient(#4150d0, #4150d0), conic-gradient(#c850c0, #c850c0), conic-gradient(#4150d0, #4150d0), conic-gradient(#c850c0, #c850c0);
background-repeat: no-repeat;
background-size: 50% 50%, 50% 50%;
background-position: 0% 0%, 0% 100%, 100% 100%, 100% 0%;
animation: animate 4s linear infinite;
z-index: -1;
}

@keyframes animate {
100% {
transform: rotate(1turn);
}
}
In the attached image you can see the background behind the text which I do not want any idea how can I remove the background behind the text so it look like a rotating border animation
5 Replies
capt_uhu
capt_uhu2y ago
do you want the background behind the "artist name" and "date" to be transparent?
Aditya Kirad
Aditya KiradOP2y ago
Yeah something like that
capt_uhu
capt_uhu2y ago
probably best to look into border-image the animation would still be an issue though. FYI you can do that gradient in 1 declaration like so:
css
background-image: repeating-conic-gradient(#fff 0 0.25turn, #000 0.25turn 0.5turn);
css
background-image: repeating-conic-gradient(#fff 0 0.25turn, #000 0.25turn 0.5turn);
Mannix
Mannix2y ago
this isn't probably what you after but it may give an idea https://codepen.io/MannixMD/pen/jOpYRwO
capt_uhu
capt_uhu2y ago
probably what you'd have to do for the animation is a registered custom property for the gradient start angle i guess another possibility might just be using a css mask on the :before
Want results from more Discord servers?
Add your server