How do I add a shadow to text using css?
-
The demo code used is:
HTML
... <h1 class="intro">Good Morning HTML!</h1> ...
CSS
... .intro { text-align: center; } ...
The result is:
To add a shadow to the text we use the CSS property
text-shadow
. It takes four values, the horizontal position, the vertical position, the blur value and the color.... text-shadow: 2px 2px 5px gray; ...
The result is:
The same effect can be added to a box, using
box-shadow
.
© Lightnetics 2024