规则阴影

coderljw 2024-10-13 CSS
  • Magic
  • 特效
小于 1 分钟

# clip-path: polygon()

drop-shadow 可以穿透元素的透明部分 (opens new window)

<main>
  <section>Magic</section>
</main>
1
2
3
main {
  height: 400px;
  display: grid;
  place-items: center;
  filter: drop-shadow(2px 4px 3px hsla(60, 100%, 10%, 0.5));
}

section {
  display: grid;
  place-items: center;
  width: 200px;
  height: 60px;
  font-size: 20px;
  color: #be9451;
  user-select: none;
  background: linear-gradient(#f5e5bf, #fbe8c8, #f5e5bf);
  clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0 50%);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
以父之名
周杰伦.mp3