You can use the font-family and text-shadow properties to create simple yet remarkable effects. You may already know about basic applications of text shadow in CSS. However, you can create a wide range of styles with these properties.
In this article, you’ll learn an effective way to create different text shadow effects using HTML and CSS.
Getting Started With HTML and CSS
You can copy and paste these code examples to get whichever text shadow effect you prefer. Start by creating an index.html file and a style.css file. These are the only files you’ll need to try out the examples, but you’ll need to change both files for each example.
index.html
style.css
Now, let’s go through 11 text shadow examples for you to try out.
Mystic
Mystic is a glassy style giving a cool transition-like effect without using the transform property. It is a super simple, yet aesthetically pleasing, effect for a bold and growth-oriented website.
Output
HTML
CSS
Monoton
This is a playful text effect using the ‘Monoton’ font. You can play around with the text and shadow color to match your website’s primary colors.
Output
HTML
CSS
Bungee
This is a cool style using the ‘Bungee Shade’ font. Combined with a dark background, it produces a raw effect with a sense of suspicion.
Output
HTML
CSS
Radioactive
You can use this effect for alert or danger signs. It uses the ‘Rampart One’ font.
Output
HTML
CSS
Sprint
This running text effect uses the ‘Faster One’ font, the text-shadow property, and an ::after pseudo-element with the same content as the text. This creates a ‘doubling’ effect.
Output
HTML
CSS
Prickly
This horrifying prickly text effect uses the ‘Eater’ font. You can try shifting the text-shadow towards the bottom-right instead.
Output
HTML
CSS
Codystar
The text-shadow can act as a blurred yet visible outline to the text. This bright effect works wonders with the ‘Codystar’ font.
Output
HTML
CSS
Kingdom
You can achieve authoritative typography with this shadow effect. It uses the ::before pseudo-element and the transform property to slant the shadow.
Output
HTML
CSS
Coder
This bright and positive text-shadow effect conveys a self-aware and motivated website personality. You can add it to your website to produce a simple smokey look.
Output
HTML
CSS
Elegant
If you love minimalism, then this text shadow effect is a perfect fit. Since it uses a large font size, we reduced the letter-spacing and applied the text-shadow property to create this effect.
Output
HTML
CSS
Playful
The thin and bold outline makes this text attractive and lively. You can play around with the text-shadow property with no blur radius at different positions. Text shadows apply to all characters, including HTML entities such as ♥. You can use a Character Entity Reference Chart to explore further.
Output
HTML
CSS
Keep Experimenting With Advanced Shadow Effects
Text shadows are an easy and effective way to enhance your web design and make your website visually appealing. You can also experiment with different shadow effects. You can learn more about drop shadow effects to continue your CSS journey.