CSS Polygon Shadow

删除回忆录丶 提交于 2019-12-05 08:46:17

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.</nav></div>

<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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!