CSS Text Shadow
CSS Text Shadow: As its name implies, this CSS property adds shadows to the text. It acknowledges the comma-separated list of shadows that applied to the text. It’s default property is none. It applies one or more than one text-shadow effect on the element’s text content.
Text Shadow
The text-shadow property adds shadow to text.
In its most straightforward use, you just specify the horizontal shadow (2px) and the vertical shadow (2px):
Example
<!DOCTYPE html> <html> <head> <style> h1 { text-shadow: 2px 2px; } </style> </head> <body> <h1>Text-shadow effect!</h1> </body> </html>
Next, add a color (red) to the shadow:
Example
<!DOCTYPE html> <html> <head> <style> h1 { text-shadow: 2px 2px red; } </style> </head> <body> <h1>Text-shadow effect!</h1> </body> </html>
Then, at that point, add a blur impact (5px) to the shadow:
Example
<!DOCTYPE html> <html> <head> <style> h1 { text-shadow: 2px 2px 5px red; } </style> </head> <body> <h1>Text-shadow effect!</h1> </body> </html>
All CSS Text Properties
Property | Description |
color | Sets the color of text |
direction | Specifies the text direction/writing direction |
letter-spacing | Increases or decreases the space between characters in a text |
line-height | Sets the line height |
text-align | Specifies the horizontal alignment of text |
text-decoration | Specifies the decoration added to text |
text-indent | Specifies the indentation of the first line in a text-block |
text-shadow | Specifies the shadow effect added to text |
text-transform | Controls the capitalization of text |
text-overflow | Specifies how overflowed content that is not displayed should be signaled to the user |
unicode-bidi | Used together with the direction property to set or return whether the text should be overridden to support multiple languages in the same document |
vertical-align | Sets the vertical alignment of an element |
white-space | Specifies how white-space inside an element is handled |
word-spacing | Increases or decreases the space between words in a text |
Thanks for reading! We hope you found this tutorial helpful and we would love to hear your feedback in the Comments section below. And show us what you’ve learned by sharing your projects with us.