Gradient borders

后端 未结 17 1427
一个人的身影
一个人的身影 2020-11-22 03:40

I\'m trying to apply a gradient to a border, I thought it was as simple as doing this:

border-color: -moz-linear-gradient(top, #555555, #111111);
         


        
17条回答
  •  无人及你
    2020-11-22 04:16

    Try this, it worked for me.

    div{
      border-radius: 20px;
      height: 70vh;
      overflow: hidden;
    }
    
    div::before{
      content: '';
      display: block;
      box-sizing: border-box;
      height: 100%;
    
      border: 1em solid transparent;
      border-image: linear-gradient(to top, red 0%, blue 100%);
      border-image-slice: 1;
    }

    The link is to the fiddle https://jsfiddle.net/yash009/kayjqve3/1/ hope this helps

提交回复
热议问题