Search code examples
htmlcssborderline

A fadeing line in html using css


I want to add this kind of line, or border if it's better to do this as an border to my site, How can I do that

enter image description here


Solution

  • Using linear-gradient css function:

    hr {
       height: 2px;
       border: 0;
       background: linear-gradient(to right, rgba(65, 191, 255, 0), rgba(65, 191, 255, 1), rgba(65, 191, 255, 0));
    }
    <hr />

    Reference:
    https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Images/Using_CSS_gradients https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient