"Is there a way to overlay gradient colors on pseudo-classes (before and after) while working with parent classes in CSS? I am attempting to create arrow shapes using div elements and the 'after' class. The div's background color consists of a linear gradient, and I tried applying the same color to the 'after' class as well. However, it resulted in two different shapes. Please see my code snippet below:
.test div {
display: inline-block;
position: relative;
height: 40px;
line-height: 25px;
padding: 0 15px 0px 25px;
border: 1px solid transparent;
background: #16a0e3;
float: left;
display: flex;
margin: 2px 2px 2px 0px;
width: 150px;
align-content: center;
justify-content: center;
align-items: center;
}
.test .hzmenu {
background: linear-gradient(45deg, black, transparent);
color: #fff;
text-align: center;
text-decoration: none;
font-size: 11px;
font-weight: normal;
text-transform: uppercase;
transform-style: preserve-3d;
}
.test .hzmenu a:after {
background: linear-gradient(45deg, black, transparent);
}
.test div a:after {
content: '';
border-top: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 29px;
height: 29px;
position: absolute;
right: -6px;
top: 1px;
z-index: 1;
-webkit-transform: translate(11px, 4px) rotate(45deg);
transform: translate(11px, 4px) rotate(45deg);
}
<div class="test">
<div class="hzmenu">
<a href="#">
Menu1
</a>
</div>
</div>