I'm trying to create a transition for both an div button and a pseudo element, but for some reason, these transitions appear to be out of sync with each other, resulting in the pseudo element reaching a background color before the div does. I've tried various combinations of style rules, but I never managed to accomplish an ease-in-out transition to work correctly.
.tracking__history {
display: flex;
justify-content: flex-start;
align-items: center;
}
.skew-btn-left {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 120px;
font-size: 20px;
color: #2E8DEF;
background: #0000;
border-top: 5px solid #13bcfa;
border-left: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
}
.skew-btn-left::after {
content: " ";
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
margin-top: -5px;
margin-left: -5px;
background: #0000;
border-top: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
border-right: 5px solid #13bcfa;
transform-origin: top left;
-ms-transform: skew(30deg, 0deg);
-webkit-transform: skew(30deg, 0deg);
transform: skew(30deg, 0deg);
transition: background 1s;
}
.skew-btn-right {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 120px;
margin-left: 40px;
font-size: 20px;
color: #13bcfa;
background: #0000;
border-top: 5px solid #13bcfa;
border-right: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
transition: all .5s;
}
.skew-btn-right::after {
content: " ";
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
margin-top: -5px;
margin-left: -5px;
background: #0000;
border-top: 5px solid #13bcfa;
border-bottom: 5px solid #13bcfa;
border-left: 5px solid #13bcfa;
transform-origin: bottom left;
-ms-transform: skew(30deg, 0deg);
-webkit-transform: skew(30deg, 0deg);
transform: skew(30deg, 0deg);
}
div.skew-btn-right:hover,
div.skew-btn-left:hover,
div.skew-btn-right:hover.skew-btn-right::after,
div.skew-btn-left:hover.skew-btn-left::after {
background: #13bcfa;
}
.skew-btn-left a, .skew-btn-right a {
display: flex;
justify-content: center;
align-items: center;
padding: 5px 0px;
text-decoration: none;
color: #13bcfa;
text-transform: uppercase;
}
.skew-btn-left:hover a, .skew-btn-right:hover a {
color: #fff;
}
<div class="tracking__history">
<div class="skew-btn-left">
<a href="">Tracking</a>
</div>
<div class="skew-btn-right">
<a href="">History</a>
</div>
</div>