I found this solution: Outline effect to text Which is great, but is it posible to make the text transparent and only the outline to draw? This happens with box-shadow, for example, as even if the box doesn't have a background, you won't see the shadow "under" the box. But with text, if it is transparent, you se the whole shadow of the type. Is it posible to get only the outline with transparent text?
EDIT: The problem with this is to have a nice fallback for browsers that don't support for example -webkit-text-outline, because they wouldn't draw the outline and they would make the text invisible...
Double click on your text layer to open the Layer Style Panel. Under 'Blending Options' set your fill opacity to 0% and set the Knockout to 'Shallow'. Next, click on the stroke tab to add a stroke to your text. Set your size to something like 5px, position to 'outside', blend mode to 'normal', and opacity to 100%.
To set the opacity of a background, image, text, or other element, you can use the CSS opacity property. Values for this property range from 0 to 1. If you set the property to 0, the styled element will be completely transparent (ie. invisible).
You can achieve the transparent text with text-stroke with an inline svg.
You can use the <text>
element (more info on MDN) set the fill
property to none
or transparent
to make the text transparent and use the stroke
porperty to make the text outline. stroke-width
and stroke-color
can define the texte stroke thickness and color
Here is an example: transparent text with a white stroke and a background image showing through the text:
body {
background: url('https://farm9.staticflickr.com/8760/17195790401_94fcf60556_c.jpg');
background-size: cover;
}
svg{width:100%;}
<svg viewbox="0 0 10 2">
<text x="5" y="1" text-anchor="middle" font-size="1" fill="none" stroke-width=".015" stroke="#fff" font-family="sans-serif">Text stroke</text>
</svg>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With