htmlcsstwitter-bootstrap

How to create a fading-out grid squares background


I want to create a grid background that fades out.

So far I've tried a conic-gradient background but I'm not sure how to get it to fade out

  background:
    conic-gradient(from 90deg at 1px 1px,#0000 90deg,grey 0) 
    0 0/50px 50px;

Solution

  • The simplest solution would be add an additional background-image that has linear-gradient from transparent to white:

    body {
      background:
        linear-gradient(180deg, #FFF0 0%, #FFFF 100%) 0 0 / 100dvw 100dvh,
        conic-gradient(from 90deg at 1px 1px, #8880 90deg, #888F 0) center -1px / 50px 50px;
    }

    or if you use some body height:

    * { margin:0; box-sizing: border-box; }
    
    body {
      min-height: 100vh;
      background:
        linear-gradient(180deg, #FFF0 0%, #FFFF 100%),
        conic-gradient(from 90deg at 1px 1px, #8880 90deg, #888F 0) center -1px / 50px 50px;
    }