Making a dotted grid with CSS

前端 未结 2 1973
一生所求
一生所求 2020-12-19 09:22

I want the whole body to have a dotted grid

2条回答
  •  庸人自扰
    2020-12-19 09:34

    Here is another way in addition to changing the background-position that may work whataver the size is:

    body {
      background-image: radial-gradient(circle at 1px 1px, black 1px, transparent 0);
      background-size: 40px 40px;
    }

    body {
      background-image: radial-gradient(circle at 1px 1px, black 1px, transparent 0);
      background-size: 50px 30px;
    }

    Basically the idea is to change the position of the dots inside the area defined by background-size to the top/left instead of shifting all the background

提交回复
热议问题