Contents
Adding text shadows in CSS
By using the CSS text-shadow
property, you can add a customized shadow to a text:
h1 {
text-shadow: 3px 3px #42bff4;
}
/* Gives a shadow for h1 header */
By combining multiple selectors, you can add the same type of shadow to multiple elements:
CSS text-shadow property syntax
To add a CSS font shadow, you need to define from two to four values:
text-shadow: h-shadow v-shadow blur-radius color;
In the example below, you can see all four values defined. All of them will be explained in detail in the following section:
Available values
Value | Description | |
---|---|---|
h-shadow | Required | The horizontal CSS text shadow position |
v-shadow | Required | The vertical CSS text shadow position |
blur-radius | Optional | The radius of the blur (0 by default) |
color | Optional | The color of the text shadow |
Notice that vertical and horizontal values can be negative: