Diagonal stripes that are 1px wide

后端 未结 2 1044
一整个雨季
一整个雨季 2020-12-01 01:54

I\'m looking to give an element a background with repeating, 1px wide diagonal stripes. It seems that repeating-linear-gradient should be able to do this, but w

2条回答
  •  误落风尘
    2020-12-01 02:43

    Many thanks to Terry for his suggested approach of using a standard linear-gradient with percentages and a background-size. With a bit of playing around, I have managed to obtain the exact gradient I was looking for:

    enter image description here

    background-image: linear-gradient(
        to right top,
        transparent 33%,
        black 33%,
        black 66%,
        transparent 66%
    );
    background-size: 3px 3px;
    

提交回复
热议问题