What I'm trying to achieve is a button like
Once it's done I need to animate on hover. The closest example I could find is this codepen
https://codepen.io/Chester/pen/QPoyjN
The problem is the ::after
that is required to apply a white background on the button
The size of the button might change based on the text length so a solution like the one given here is not valid : Rotate only the Border using CSS
Here's what I got so far, the goal is to keep a similar animation but remove the white background
.background {
width: 600px;
height: 600px;
display: flex;
align-items: center;
justify-content: center;
background-image: url("https://via.placeholder.com/600");
}
.button-file {
display: block;
position: relative;
text-align: center;
z-index: 0;
border-radius: 30px;
max-width: 363px;
max-height: 46px;
border-radius: 30px;
overflow: hidden;
padding: 1rem 2rem;
}
.button-file::before {
content: '';
position: absolute;
z-index: -2;
left: 50%;
top: 50%;
width: 400px;
height: 400px;
border-radius: 30px;
background-repeat: no-repeat;
background-size: 50% 50%, 50% 50%;
background-position: 0 0, 100% 0, 100% 100%, 0 100%;
background-image: linear-gradient(#44a0b0, #44a0b0), linear-gradient(#44a0b0, #44a0b0), linear-gradient(#eeb450, #eeb450), linear-gradient(#eeb450, #eeb450);
transform: translate(-50%, -50%) rotate(11deg);
transition: transform .7s cubic-bezier(1, 0, 0, 1);
}
.button-file:hover::before {
transform: translate(-50%, -50%) rotate(191deg);
}
.button-file::after {
content: '';
position: absolute;
z-index: -1;
left: 3px;
top: 3px;
width: calc(100% - 6px);
height: calc(100% - 6px);
background: #fff;
border-radius: 30px;
}
<div class="background">
<div class="button-file">
<a>En savoir +</a>
</div>
</div>