I am trying to make the button background transparent after the CSS transition on Shopify, but can’t seem to do so. Please help.
Here are my CSS codes:
.btn.btn1::before {
top: 0px;
bottom: 0px;
right: 0px;
left: 0px;
width: 100%;
height: 100%;
position: absolute;
z-index: -1;
content: '';
transform: scaleX(0);
transform-origin: left;
transition: transform 600ms ease-in-out;
background: #E9E9E9;
}
.btn.btn1:hover::before,
.btn.btn1:focus::before {
transform: scaleX(1);
}
.btn.btn1:hover {
color: gray !important;
z-index: 1;
}
.btn.btn1:hover:after {
transform: translateX(0px);
}
Site: https://polished-london.myshopify.com/
Password: home
2
Answers
You could just add an animation to the
.btn.btn1:hover::before, .btn.btn1:focus::before
selectors that would cause the background of the::before
pseudo element to be transparent after the background changes color. To see where the main change is, you can look in the "IMPORTANT CODE" section.You should exactly specify which button you are referring to.