Search code examples
htmlcsstwitter-bootstrapscanline

How to get scanlines over background image in CSS


I have a full-page background image that I'd like to overlay scanlines over. I'm wanting to replicate the more traditional diagonal scanline effects that I grew up seeing in digital art of the noughties, such as implemented here in Bootstrap's pattern mask 5:

enter image description here

I've seen a few tutorials for diagonal scanlines, but haven't been able to find anything like this. How would I accomplish it in CSS?


Solution

  • here is an approximation using multiple background:

    html {
      height:100%;
      background:
        radial-gradient(#000 0.5px,transparent 0.5px) 0   0   /3px 3px,
        radial-gradient(#000 0.5px,transparent 0.5px) 1px 1px /3px 3px,
        radial-gradient(#000 0.5px,transparent 0.5px) 2px 2px /3px 3px,
        url(https://i.picsum.photos/id/102/800/800.jpg) center/cover;
    }

    You can compare with the below that use the image pattern

    html {
      height:100%;
      background:
        url(https://i.ibb.co/C0MjrsJ/05.png),
        url(https://i.picsum.photos/id/102/800/800.jpg) center/cover;
    }