Rotating border
+ ANIMATION :
+ Description :
This animation is displaying persons’ cards with a rotating border.
In order to achieve it you will find below the various codes to be used. Despite using Bricks builder, I tried to list up all the necessary steps to complete the animation to be the most universal as much as possible. Therefore I am close to what you will find in any IDE. For Bricks builder, please follow the HTML/CSS structure so you can add-up divs and give them CSS (be careful with the buttons) instead of putting it into the code block in order to avoid FOUC as the code block is loaded lastly within the page priority list.
For CSS, please note that I am considering that you are using a builder hence: no margin/padding/button reset has been applied and the font is not defined.
HTML:
<section class="rtt-section"> <div class="rtt-ctn"> <div class="rtt-inner"> <img src="/SUPERBOX/Rotating border/Pictures/agence-kokoro-R0006144.jpeg" alt="" class="rtt-img" /> <button class="rtt-btn" href="">Contact me !</button> </div> </div> <div class="rtt-ctn"> <div class="rtt-inner"> <img src="/SUPERBOX/Rotating border/Pictures/agence-kokoro-R0004362.jpeg" alt="" class="rtt-img" /> <button class="rtt-btn" href="">Contact me !</button> </div> </div> <div class="rtt-ctn"> <div class="rtt-inner"> <img src="/SUPERBOX/Rotating border/Pictures/agence-kokoro-67.jpeg" alt="" class="rtt-img" /> <button class="rtt-btn" href="">Contact me !</button> </div> </div> </section>
CSS:
.rtt-section { display: flex; flex-direction: row; height: 100vh; width: 100%; align-items: center; justify-content: center; background-color: #202020; } .rtt-ctn { background-color: #202020; margin: 3rem; width: 240px; height: 240px; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; border-radius: 50%; box-shadow: 13px 13px 24px #111111, -13px -13px 24px #2f2f2f; z-index: 0; } .rtt-inner { background-color: #202020; width: 92%; height: 92%; display: flex; align-items: center; justify-content: center; position: relative; border-radius: 50%; box-shadow: inset 13px 13px 24px #111111, inset -13px -13px 24px #2f2f2f; } .rtt-img { width: 87%; height: 87%; border-radius: 50%; transition: all 0.3s ease; object-fit: cover; } .rtt-btn { position: absolute; color: white; font-size: 1.2rem; transition: all 0.3s ease; padding: 0.5rem 1rem; border: 1px solid #9b69f7; border-radius: 0.5rem; transform: scale(0); cursor: pointer; } .rtt-inner::after { content: ""; position: absolute; top: 50%; left: -5%; width: 120%; height: 50%; z-index: -1; background-color: #9b69f7; transform: translateY(-50%); transform-origin: 50% 50%; transition: all 0.3s linear; } .rtt-ctn:hover .rtt-inner::after { transform: rotate(180deg) translateY(50%); } .rtt-ctn:hover .rtt-btn { transform: scale(1); } .rtt-ctn:hover .rtt-img { opacity: 0.3; } .rtt-ctn:hover .rtt-img { width: 100%; height: 100%; } @media screen and (max-width: 1150px) { .rtt-section { flex-direction: column; } }