Making a dotted grid with CSS

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

I want the whole body to have a dotted grid

2条回答
  •  旧时难觅i
    2020-12-19 09:33

    Update

    The following solution works, but only for a fixed background-size. See @Temani Afif's answer for a better solution.

    Answer

    You can use the background-position CSS property to do exactly what you were thinking.

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

提交回复
热议问题