Drawing a grid using CSS

前端 未结 7 2073
青春惊慌失措
青春惊慌失措 2021-02-07 00:20

I\'m looking for a way to draw a grid (i.e. http://www.artlex.com/ArtLex/g/images/grid.gif) inside of a div, using CSS (and JS if necessary). It feels like it should be relative

7条回答
  •  滥情空心
    2021-02-07 01:03

    "Pure CSS" and exactly 100px2 grid.

    (A variation of the top-voted answer, above.)

    body { box-sizing:border-box; margin:0; height:100%; width:100%; background-size:100px 100px;
           background-image: repeating-linear-gradient(0deg, transparent, transparent 99px, #ccc 99px, #ccc 100px), 
           repeating-linear-gradient(-90deg, transparent, transparent 99px, #ccc 99px, #ccc 100px); 
         }

提交回复
热议问题