22

CSS font shadows are often used to help make text stand out (or in, or colorful, or many other fancy things.) I'm wondering if it can be used to aid readability.

I know finding the right amount of contrast can help greatly on digital screen readability. Font shadows are always surround the text, so it could be used to control contrast, both brightness and color. reference: Is there a problem with using black text on white backgrounds?

Gn13l
  • 323
  • 1
  • 2
  • 6
  • There have been great answers so far. Are there any use cases where font-shadow might be used to improve readability against a solid background? And could it be used to benefit the copy (or larger body of text) rather than just title and headlines? – Gn13l Jan 27 '15 at 16:21
  • I've added an edit to my answer for this. – Gaurav Ramanan Jan 28 '15 at 15:42

5 Answers5

17

Apart from the answer given, I would like to mention one very important Use Case where the solution is nothing BUT shadows.

Text on an image

When you don't have control over the image on top of which you are writing text, you have to ensure proper contrast for best readability. A Big hero Image seems to be rage these days. A dark shadow is added behind white text and a light shadow behind black text.

The old Nexus website made heavy use of the fact, because the version of Roboto that looks amazing on photos is the Ultra Thin one. It is white coloured text with a dark shadow so as to give contrast on top an image without sacrificing font-weight or adding an overlay. We used this fact on our own website.

enter image description here

EDIT After OP has posted the comment, a use case of having shadows on top a solid background may be where we are not control of the background (say its coming from a CMS). If we have white text, we can use a black shadow and the text will be visible on black backgrounds and somewhat in white backgrounds as well.

Gaurav Ramanan
  • 570
  • 2
  • 8
  • This question is the gift that keeps on giving. Thank you for updating your answer. It seems to me that the general assessment of the UX community is that text shadows are best used to improve readability when the background (or whatever may be rendering behind your text) is outside your control. I really enjoyed Code Maverick's answer, but the use-case might be in the minority. – Gn13l Jan 28 '15 at 19:14
  • @Gn13l Glad we could help. Now you have the tough task of selecting the best answer! StackExchange etiquette yous see! – Gaurav Ramanan Jan 28 '15 at 19:33
16

In some situations a drop shadow or stroke can be used to maximise accessibility and maintain the contrast ratio between text and the background. I have used this method once or twice when dealing with strict brand guidelines that demanded non-conforming colour combinations. It is mentioned as a technique for meeting the SC 1.4.3 (Contrast) criterion of WCAG:

...if a letter is lighter at the top than it is a the bottom, it may be difficult to maintain the contrast ratio between the letter and the background over the full letter. In this case, the designer might darken the background behind the letter, or add a thin black outline (at least one pixel wide) around the letter in order to keep the contrast ratio between the letter and the background above 4.5:1.

Matt Obee
  • 14,486
  • 4
  • 57
  • 63
  • 2
  • Could you provide an image as an example of when it could be needed/useful? 2) What does "non-conforming color combinations" mean? (probably I don't get it because of my not-so-good english)
  • – Alejandro Veltri Jan 27 '15 at 15:45
  • 3
    @rewobs WCAG accessibility guidelines require a contrast ratio of at least 4.5:1 between text and the background to ensure readability. If for whatever reason you are forced to use a particular combination of text colour and background colour that doesn't meet that requirement, you can sometimes add a background around the letters using an outline or shadow to ensure sufficient contrast. I'll see if I can find an example. – Matt Obee Jan 27 '15 at 15:49
  • Oh I got it, I used to do it in graphic designs when I got on those without-option situationn, I didn't know it was part of a standard/guideline. Good to know, thanks! – Alejandro Veltri Jan 27 '15 at 15:54
  • 2
    @MattObee One particular instance of that I (unfortunately) come across every now and then is needing to put light text on to a completely mid grey bg (#808080) where no colour will get the required contrast to meet the guidelines. http://snook.ca/technical/colour_contrast/colour.html#fg=FFFFFF,bg=808080 – Roger Attrill Jan 27 '15 at 15:55
  • @Roger Attrill Yes, that sort of thing. We had something where a client wanted a twitter button in twitter blue (#55ACEE) with white text, which is only 2.46. – Matt Obee Jan 27 '15 at 17:39