HTML Academy
Shadow, drop-shadow
CSS filters7/14
Back to the list of tasks
  • 1. Brightness and Contrast
  • 2. Grayscale and Sepia
  • 3. Invert and Saturate
  • 4. Color Rotation, hue-rotate
  • 5. Blur and Opacity
  • 6. Shadow, drop-shadow
  • 7. The Difference Between box-shadow and drop-shadow
  • 8. Applying CSS Filters to Text
  • 9. Challenge: Using Various Filters
  • 10. Combination of Filters
  • 11. Combining the drop-shadow Filters
  • 12. Animating CSS Filters
  • 13. Smooth Transitions and CSS Filters
  • 14. Challenge: Filter Combinations
Applying CSS Filters to Text
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

The Difference Between box-shadow and drop-shadow

The shadow filter has advantages over the box-shadow property.

First, when the drop-shadow filter is rendered in the browser, it uses hardware acceleration, which improves performance. However, there is no additional acceleration when you use the box-shadow property in the browser.

Secondly, the drop-shadow filter is applied to the opaque outline of the images, while the transparent areas are ignored. On the other hand, the box-shadow sets a rectangular shadow around the border of the entire image.

Based on the example semi-transparent PNG image, you can see how these two properties work. But if you assign an opaque background to such an image, you can see how the filter behavior changes.

It should be noted that filters were borrowed into CSS from SVG, so drop-shadow and box-shadow are different in their implementations. That is, the shadows look different given the same parameters.

Let’s compare the shadow effects using an example.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>The Difference Between box-shadow and drop-shadow</title> <link href="course.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"> </head> <body> <div class="compare symbol"> <div class="compare-left box-shadow"> <img src="img/symbol.png" alt=""> </div> <div class="compare-left filter-shadow"> <img src="img/symbol.png" alt=""> </div> </div> </body> </html>
CSS
.box-shadow img { } .filter-shadow img { }

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

The code has changed, click “Refresh” or turn autorun on.

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%
Goalscompleted
0
    1. Assign the shadow box-shadow: 0 0 10px red to the image in the .box-shadow block,
    2. For the image in the .filter-shadow block, assign a drop-shadow filter with the value 0 0 10px red.
    3. And then assign a white background color to both images: background-color: #ffffff.

    Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2025

    VISAMastercard

    Log in

    or

    Forgot your password?

    Sign up

    Sign up

    or
    Log in

    Restore access

    Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

    Forgot to connect your email to the profile? Email us and we’ll help.