对话框小三角的css 实现

30 阅读1分钟

111111.jpg

.activeCard {
  border: 1px solid #bda6ff;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.9) 100%),
    linear-gradient(102deg, #bda6ff 3.38%, #7a9eff 98.18%);
  position: relative;
  &::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #bda6ff;
  }
  &::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #f8f6ff;
  }
}

参考:juejin.cn/post/698162…