SCSS

by Bartek Legięć

HTML

<footer>Sources: <a href="https://unsplash.it" target="_blank">https://unsplash.it</a></footer>

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

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: linear-gradient(135deg, #1e5799 0%, #FF0000 100%);
}
  
.img-2 { 
  background-image: url("https://unsplash.it/300/300?image=1069");
}
  
.img-3 {
  background-image: url("https://unsplash.it/300/300?image=1022");
}
  
.img-4 {
  background-image: url("https://unsplash.it/300/300?image=981");
}

body {
  background: #151515;
  height: 100vh;
  width: 100%;
  margin: 0;
  padding: 16px;
  box-sizing: border-box;
}
  
.grid {
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

  &, a {
    color: #fff;
  }
}