4

I am trying to make the text shadow effect as per the example below:

text shadow

This is what I have created:

.yb-shipping {
  color: #f2de4d;
  font-family: Arial,Helvetica,sans-serif;
  font-size: 22px;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(1, 96, 116, 1);
  text-transform: uppercase;
}
<div class="yb-shipping">Free Shipping</div>

Not able to make as attached, should I try something else except text-shadow?

Please suggest

5 Answers 5

8

If you use a blur radius, the shadow will be blurred, and that's not the intended result.
You can, however, use multiple text-shadows. So that's the solution: add several of them, all with a blur radius of 0, in different directions.

.yb-shipping {
  color: #f2de4d;
  font-family: Arial,Helvetica,sans-serif;
  font-size: 22px;
  font-weight: bold;
  text-shadow: -2px -2px 0 rgba(1, 96, 116, 1),
               2px -2px 0 rgba(1, 96, 116, 1),
               -2px 2px 0 rgba(1, 96, 116, 1),
               2px 2px 0 rgba(1, 96, 116, 1),
               -3px 0 0 rgba(1, 96, 116, 1),
               3px 0 0 rgba(1, 96, 116, 1),
               0 -3px 0 rgba(1, 96, 116, 1),
               0 3px 0 rgba(1, 96, 116, 1);
  text-transform: uppercase;
}
<div class="yb-shipping">Free Shipping</div>

Sign up to request clarification or add additional context in comments.

Comments

3

You can combine many shadows

.yb-shipping {
  color: #f2de4d;
  font-family: Arial,Helvetica,sans-serif;
  font-size: 22px;
  font-weight: bold;
  text-shadow: 
    2px 2px 2px rgba(1, 96, 116, 1),
    -2px 2px 2px rgba(1, 96, 116, 1),
    2px -2px 2px rgba(1, 96, 116, 1),
    -2px -2px 2px rgba(1, 96, 116, 1);
  text-transform: uppercase;
}
<div class="yb-shipping">Free Shipping</div>

Comments

1

you can use -webkit-text-stroke as below:

.yb-shipping {
  color: #f2de4d;
  font-family: Arial,Helvetica,sans-serif;
  font-size: 22px;
  font-weight: bold;
  -webkit-text-stroke: 2px rgba(1, 96, 116, 1);
  text-transform: uppercase;
}

1 Comment

MDN (developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-stroke) says: "Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future."
1

Please see the following:-

https://jsfiddle.net/enryhfz3/

If you change you text-shadow to :-

text-shadow:
    -1px -1px 5px rgba(1, 96, 116, 1),  
    1px -1px 5px rgba(1, 96, 116, 1),
    -1px 1px 5px rgba(1, 96, 116, 1),
    1px 1px 5px rgba(1, 96, 116, 1);

Comments

0

This generator can help you make text shadow more accureate. http://css3gen.com/text-shadow/ and http://www.css3generator.in/text-shadow.html The codes can be copy and paste directly.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.