SCSS

by Bartek Legięć

HTML

<div class="grid">
  <div class="dynamic-shadow img-1"></div>
</div>

<footer>Source: <a href="https://www.packagingoftheworld.com/2017/08/nitro-brew-co-student-project.html" target="_blank">https://www.packagingoftheworld.com</a></footer>

SCSS

.dynamic-shadow {
  position: relative;
  width: 300px;
  height: 300px;
  z-index: 1;
  margin: 3rem;
  border-radius: 5px;
  background-size: cover;
  
  &::before, &::after {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    background: inherit;
    top: 0;
    left: 0;
    opacity: 1;
    z-index: 2;
    border-radius: inherit;
  }
  
  &::before {
    filter: blur(25px);
    opacity: 1;
    z-index: 1;
  }
}
  

.img-1 {
  background-image: url("https://static1.squarespace.com/static/52536652e4b007332ef4ecf4/t/599b2559be42d69855340076/1503339876591/FINAL_GIFF.gif");
  height: 424px;
}

body {
  background: #151515;
  height: 400px;
  width: 100%;
  margin: 0;
  padding: 16px;
  box-sizing: border-box;
}
  
.grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  align-items: center;
  justify-items: center;
}

footer {
  text-align: center;
  font-family: Noto Serif;
  padding: 32px 0;
  font-style: italic;

  &, a {
    color: #fff;
  }
}