Alternative to drop-shadow filter for displaying shadow around custom shape

830 views Asked by At

In an attempt to create shadows around custom shapes, I discovered the drop-shadow filter CSS property. However after having implemented it, I realised that it slowed the website down significantly.

I am therefore searching for an alternative to gain the same effect without compromising the load speed of the page.

The main content of the site is surrounded by a shadow-box wrapper using a box shadow, but this could not be used for the end section due to the transparent part of the background.

I am trying to achieve a shadow which resembles the shadow of the shadow-box.

Here is a jsFiddle illustrating how it currently looks

and here it can bee seen on the real site

HTML

<div class="container shadow-box no-padding"></div>
  <div class="container justify-content-center">
  <section class="light-bg end-section" id="portfolio"></section>
</div>

CSS

.container{
  width:70%;
  margin:auto;
}    
.shadow-box{
  background:green;
  height:200px;
  -webkit-box-shadow: 0px 0px 21px 8px rgba(0, 0, 0, 0.6) !important;
  -moz-box-shadow: 0px 0px 21px 8px rgba(0, 0, 0, 0.6) !important;
  -ms-box-shadow: 0px 0px 21px 8px rgba(0, 0, 0, 0.6) !important;
  -o-box-shadow: 0px 0px 21px 8px rgba(0, 0, 0, 0.6) !important;
  box-shadow: 0px 0px 21px 8px rgba(0, 0, 0, 0.6) !important;
}    
.end-section {
  background: radial-gradient(circle at 50% 100%, transparent 50px, #c1c1c1 50px);
  z-index: 5;
  height:200px;
  filter: drop-shadow(0 30px 15px rgba(0, 0, 0, 0.6))
  drop-shadow(0 10px 5px rgba(0, 0, 0, 0.6));
}    
.light-bg:before {
  content: '';
  position: absolute;
  z-index: 3;
  top: -50px;
  left: 50%;
  margin-left: -50px;
  height: 50px;
  width: 100px;    
  border-top-left-radius: 100px;
  border-top-right-radius: 100px;
  background: #c1c1c1;
}
0

There are 0 answers