个人技术分享

 什么?渐变色的 border 无法设置 radius?

你5年开发了。ui 能做出的东西,你说你做不出来?

.box {
  width: 100px;
  height: 150px;
  position: relative;
  z-index: 1;
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    border-radius: inherit;
    background-image: linear-gradient(135deg, rgba(124, 144, 218, 1), #495ca0, #3c4a82);
  }

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background-clip: content-box;
    padding: 1px;
    background-image: linear-gradient(180deg, #6171aa 0%, #394268 100%);
  }
}

说实话,有 n 种解决方式

希望同样身为前端的你们能享受痛苦的感觉,享受每次让你头疼的需求,不要说轻易说无法实现。

前端的苦前端自己吃