csscss-gradients

Generating a css gradient with single color


I am trying to generate a gradient using one single color and then varying the brightness or some other related variable.

Is it possible to do so ?


Solution

  • You can use alpha channel for this purpose. Consider color "#428383":

    div {
      background-color: #428383; /* for browsers without gradient support */
      background: linear-gradient(#42838344, #428383ff);
      width: 100px;
      height: 100px;
    }
    <div></div>