简体   繁体   中英

CSS Text with Linear Gradient, Shadow and Text Outline?

Is it possible to create text which has a linear gradient, a shadow and an outline.

My problem is that "-webkit-text-fill-color: transparent" is required for the gradient, so the shadow is on top of the text.

Is it possible to get the text on top of the shadow?

Here's my code:

 p { font-size: 100px; background: linear-gradient(to bottom, red, blue); -webkit-background-clip: text; -webkit-text-fill-color: transparent; -webkit-text-stroke: 2px black; text-shadow: 15px 15px black; }
 <p>Some Text</p>

Try this:

 p { font-size: 100px; background: linear-gradient(to bottom, red, blue); -webkit-background-clip: text; -webkit-text-fill-color: transparent; -webkit-text-stroke: 2px black; filter: drop-shadow(15px 15px black); }
 <p>Some Text</p>

so you overwrite text-shadow

Screenshot of the result

You can use the code like below:

p {
color: black;
background: -webkit-linear-gradient(#1de268, #4662FF);
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color:#FF8802;
-webkit-text-fill-color:transparent;
-webkit-background-clip: text;
text-shadow: 0px -8px 2px rgba(0,0,0,0.25);
}

Yes dear, you can give negative value to your shadow. for example = text-shadow : -3px -5px black;

You change the shadow property. Instead of using text-shadow , try:

filter: drop-shadow(15px 15px black);

Hi Please take a look at code snippet may be it help you

 p { color: blue; font-size: 100px; background: linear-gradient(to bottom, red, blue); -webkit-background-clip: text; -webkit-text-fill-color: rgba(255,255,255,0.3); -webkit-text-stroke: 2px black; text-shadow: 15px 15px 2px rgba(0,0,0,0.9); }
 <p>Some Text</p>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM