Is it possible to make a gradient border?

前端 未结 12 1108
陌清茗
陌清茗 2020-12-16 16:54

As the title states, is it possible to make a gradient border in CSS3 and if so how? I know that you can make gradient backgrounds and there are many generators for that, bu

12条回答
  •  生来不讨喜
    2020-12-16 17:51

    You can try this:

    div {
      width: 170px;
      height: 48px;
      border-radius: 24px;
      border-style: solid;
      border-width: 2px;
      border-image-source: linear-gradient(to bottom, #fff042, #ff5451);
      border-image-slice: 1;
      background-image: linear-gradient(to bottom, #f9e6e6, #c5e0c3), linear-gradient(to bottom, #fff042, #ff5451);
      background-origin: border-box;
      background-clip: content-box, border-box;
      display: flex;
      align-items: center;
      justify-content: center;
      text-transform: uppercase;
    }
    button

提交回复
热议问题