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:
    87f48d3e-23af-4ff1-9e10-4d5b527bcbc8-image.png

    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:
    dda99062-1f5a-4456-aaa1-d78e32f76a36-image.png

    The same effect can be added to a box, using box-shadow.


Log in to reply
 

© Lightnetics 2024