Consider the HTML
<section id="speak-to-our-experts">
<a class="mega-link mega-link--primary" href="#">
<h2>get in touch</h2>
<span>speak to one of our experts</span>
</a>
</section>
The following CSS causes me problems with the text in the anchor element.
#speak-to-our-experts {
.mega-link {
display: block;
padding: 3.5rem 0 4.625rem;
width: 100%;
text-decoration: none;
text-align: center;
transition: background-color .3s;
position: relative;
&.mega-link--primary {
background-color: #ef0d33;
color: $white;
overflow: hidden;
}
&.mega-link--primary:hover:before {
transform: translateX(10%) skew(-20deg);
opacity: 1;
}
&.mega-link--primary:before {
content: "";
position: absolute;
top: 0;
right: 0;
width: 140%;
height: 100%;
transform: translateX(100%);
background-color: #cb0b2b;
opacity: 0;
transition: transform 1.1s ease,opacity .3s ease;
}
}
}
Although I get the slide in effect from the pseudo element as required - the opacity causes me problems as it hides the text underneath. I've experimented with z-index
to no avail. What's happening here?