HOME C C++ PYTHON JAVA HTML CSS JAVASCRIPT BOOTSTRAP JQUERY REACT PHP SQL AJAX JSON DATA SCIENCE AI

CSS Shadow Effects

CSS shadow effects refer to techniques used to create visual shadows around HTML elements on a webpage using Cascading Style Sheets (CSS). Shadows can enhance the appearance of elements, providing depth and dimensionality to the design. There are several types of shadow effects that can be achieved using CSS:

CSS Text Shadow

CSS text-shadow is a property that allows you to add a shadow effect to the text of an HTML element. It can be used to enhance the visual appearance of text by creating a shadow behind it. The text-shadow property takes a set of values to define the offset, blur radius, and color of the shadow.

Example

h1 {
  text-shadow: 2px 2px;
}

Output

Text-shadow effect!

Next, add a color (red) to the shadow:

Example

h1 {
  text-shadow: 2px 2px red;
}
You can click on above box to edit the code and run again.

Output

Text-shadow effect!

Then, add a blur effect (5px) to the shadow:

Example

h1 {
  text-shadowv: 2px 2px 5px red;
}
You can click on above box to edit the code and run again.

Output

Text-shadow effect!

More Text Shadow Examples

Example 1

Text-shadow on a white text:

h1 {
  color: white;
  text-shadow: 2px 2px 4px #000000;
}
You can click on above box to edit the code and run again.

Output

Text-shadow effect!

Example 2

Text-shadow with red neon glow:

Text-shadow with red neon glow:

              

h1 {
  text-shadow: 0 0 3px #ff0000;
}
You can click on above box to edit the code and run again.

Output

Text-shadow with red neon glow!

Example 3

Text-shadow with red and blue neon glow:

             

h1 {
  text-shadow: 0 0 3px #ff0000, 0 0 5px #0000ff;
}
You can click on above box to edit the code and run again.

Output

Text-shadow with red and blue neon glow!

Example 4

h1 {
  color: white;
  text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue;
}
You can click on above box to edit the code and run again.

Output

Text-shadow effect!