Text Effects in CSS
Text Effects in CSS — Enhancing Typography Visually
CSS offers a variety of properties to create visually appealing text effects beyond basic styling.
Common Text Effects
1. Text Shadow
Adds shadows to text, creating depth or glow effects.
h1 { text-shadow: 2px 2px 5px rgba(0,0,0,0.3);}Syntax:
text-shadow: offset-x offset-y blur-radius color;
2. Text Stroke (WebKit Only)
Outlines text with a stroke.
h2 { -webkit-text-stroke: 1px black; color: white;}3. Letter Spacing
Increases or decreases space between characters.
p { letter-spacing: 2px;}4. Word Spacing
Controls spacing between words.
p { word-spacing: 10px;}5. Text Transform
Change the case of text.
h3 { text-transform: uppercase; /* uppercase, lowercase, capitalize */}6. Text Decoration
Underline, overline, line-through, or none.
a { text-decoration: underline; text-decoration-color: red; text-decoration-style: wavy;}7. Text Overflow
Handles overflowed text with ellipsis or clipping.
p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}8. Text Fill Color (WebKit Only)
Fills text with color or gradients.
h1 { -webkit-text-fill-color: transparent; background: linear-gradient(to right, red, blue); -webkit-background-clip: text;}9. Blend Modes
Blend text color with background.
h2 { mix-blend-mode: multiply;}10. Animating Text
Animate text properties with CSS animations or transitions.
h1 { transition: color 0.3s ease;}h1:hover { color: red;}Example: Glowing Neon Text
.glow { color: #0ff; text-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 20px #0ff, 0 0 40px #0ff;}If you'd like, I can help create cool text effect demos, or explain how to combine these effects for creative typography!