I'm using the clip-path
property to shape my block element.
clip-path: polygon(0 0, 100% 0, 100% 100px, 50% 100%, 0 100px);
I would like to put a "drop shadow" in that element. So, I've tried some techniques, like:
box-shadow: 0 15px 30px 0 rgba(0, 0, 0, 0.5);
Or...
filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.5));
See my test environment on CodePen.
Is it possible with CSS or SVG?
As it was said in the comments, you need 2 nested elements for this, the inner for the clipping and the outer for the shadow.
body {
background-color: gray;
}
.navigation {
filter: drop-shadow(0 15px 30px rgba(0, 0, 200, 0.5));
}
.innernav {
/* PATH */
clip-path: polygon(0 0, 100% 0, 100% 100px, 50% 100%, 0 100px);
/* OTHERS */
background-color: silver;
color: white;
height: 150px;
position: fixed;
text-align: center;
top: 0;
width: 100%;
z-index: 100;
}
.main {
padding: 200px 20px 0;
text-align: center;
}
<nav class="navigation"><div class="innernav">Hi, I'm a nav.</div></nav>
<main class="main">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates quia velit modi veniam! Velit fuga facilis blanditiis iure aperiam cumque quasi officia quaerat dignissimos neque repellat quisquam voluptates sequi, hic?</p>
</main>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With