3

I'm trying to reproduce this kind of text, with transparency inside of it and only a border : Example of what I'm trying to make

Is this possible to make this in CSS, even with Javascript ?

Hicka
  • 157
  • 3
  • 16

3 Answers3

3

Using text-stroke:

span {
  font-size: 8rem;
  color: black;
  -webkit-text-fill-color: transparent; /* Will override color (regardless of order) */
  -webkit-text-stroke-width: 1px;
  -webkit-text-stroke-color: black;
}
<span>ICY</span>
Hicka
  • 157
  • 3
  • 16
Christian Carrillo
  • 2,751
  • 2
  • 9
  • 15
2

You can do it by :

  color: transparent;
  -webkit-text-fill-color: transparent; /* Will override color (regardless of order) */
  -webkit-text-stroke-width: 1px;
  -webkit-text-stroke-color: white;

Reference: https://css-tricks.com/adding-stroke-to-web-text/

Kamran Allana
  • 543
  • 1
  • 6
  • 25
-2

Technically, you can add a border with some browser-specific prefixes, but don't. IF YOU DO THIS, IT WILL NOT BE SUPPORTED BY ALL BROWSERS. Unfortunately, there is no way to produce an actual border with CSS currently, at least within a regular HTML element. However, you can achieve something similar with SVG.

The Entramanure
  • 19
  • 1
  • 1
  • 5