How to draw a grid in CSS

1 Answer

0 votes
<!-- html -->

<html>
<body>
<div class="grid"></div>
</body>
</html>
/* css */

html, 
body,
.grid {
    height: 100%;
    width: 100%;
    margin: 0;
}
.grid {
    background-image:
      repeating-linear-gradient(#ccc 0 1px, transparent 1px 100%), /* rows */
      repeating-linear-gradient(90deg, #ccc 0 1px, transparent 1px 100%); /* cols */
    background-size: 50px 50px;
}

 



answered Jan 7, 2021 by avibootz
edited Jan 7, 2021 by avibootz

Related questions

1 answer 403 views
1 answer 397 views
5 answers 818 views
5 answers 890 views
...