Is there a possibilty to combine text gradient with box shadow? See example-image to understand what exactly I want to achive.Example-Image
I've achived the Gradient, but the box shadow I added after, appears in foreground. How can I solve that?
h2 {
display: inline-block;
background-image:linear-gradient(90deg,#c93718 0%,#035b34 30%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
box-shadow: inset 0px 30px white;
}
Would love to get some help!
Thank's! (I'm sorry for my english)
You can try multiple background:
h2 {
display: inline-block;
font-size:50px;
color:transparent;
background-image:
linear-gradient(90deg,#c93718 0%,#035b34 30%),
linear-gradient(#ccc,#ccc);
-webkit-background-clip:
text,
padding-box;
background-clip:
text,
padding-box;
-webkit-text-fill-color: transparent;
}
<h2>A title here</h2>
This won't work on Firefox due to a know bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1571244
As an alternative for Firefox, consider pseudo element:
h2 {
display: inline-block;
font-size: 50px;
color: transparent;
background-image: linear-gradient(90deg, #c93718 0%, #035b34 30%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
position: relative;
}
h2::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
background: #ccc;
}
<h2>A title here</h2>