CSS

Understanding CSS Shadows: box-shadow vs drop-shadow

Difference box-shadow and drop-shadow in CSS and how it is different?

9/9/2024
0 views
css-shadow.htmlHTML
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }

      body {
        background: #212121;
      }
      section {
        width: 100%;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
      }

      img {
        /* Box Shadow */
        box-shadow: 0 0 15px #fbf792;
        /* Drop Shadow */
        filter: drop-shadow(0 -5px 15px #fbf792);
      }
    </style>
  </head>
  <body>
    <section>
      <img src="princess.png" alt="" width="250" />
    </section>
  </body>
</html>
CSSBox-ShadowDrop-ShadowWeb Design

Loading comments...

Related Examples