5

I'm trying the new text-stroke features and I've searched the web for a cross browser solution. For now I only could find it with webkit properties.

-webkit-text-stroke: 2px #FF1E00;

Could you let me know if there is a way so all browsers will display in the same way?

BoltClock
  • 665,005
  • 155
  • 1,345
  • 1,328
Daniel Ramirez-Escudero
  • 3,629
  • 12
  • 41
  • 75

4 Answers4

11
.strokeme
{
    color: white;
    text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;  
}

from: Outline effect to text

"What I have done instead is used the already supported text-shadow property (supported in Chrome, Firefox, Opera, and IE 9 I believe)."

Community
  • 1
  • 1
niico
  • 9,173
  • 19
  • 72
  • 140
5

As of May 24th, 2012, there is no cross-browser solution, as only webkit supports the experimental feature according to http://caniuse.com/#search=text-stroke. You can simulate this (to some degree) with 4 or 5 text-shadow's on an element.

Demo: Text Stroke, on CSS-Tricks.com

Sampson
  • 259,174
  • 73
  • 529
  • 557
0

You could try strokeText.js, a vanilla javascript plugin.

  • Strokes do not overlap your text like they do with -webkit-text-stroke
  • Supports all browsers except IE8 and below
  • Selectable text
  • Dependency-free

Full disclosure, I made the plugin.

inorganik
  • 22,637
  • 17
  • 84
  • 105
0

This can't be done natively cross-browser, but it can be implemented with a fallback for unsupported browsers:

color: blue;
-webkit-text-stroke-color: blue;
-webkit-text-fill-color: white;
-webkit-text-stroke-width: 3px;

That way, webkit browsers will display white text with blue outline, but other browsers will still display the color of your choosing (this case blue).

David
  • 929
  • 1
  • 12
  • 18