I tried to make some square background using CSS only, but i got just line background without the option of horizontal lines.
This is my example code:
.container{
background-color:red;
width: 400px; height:200px; margin:0 auto;
background-image: linear-gradient(90deg, rgba(255, 255, 255, .5) 95px , transparent 50%),
linear-gradient(rgba(255, 255, 255, 0) 5px, transparent 100%);
background-size: 100px 100%;
}
<div class="container">
</div>
All you need is one
conic-gradient
:In case you want to explicitly define the number of row/column that will adjust based on the element width/height you can do like below:
You can also do it with
mask
in case you want more complex coloration:The above examples will create an homogeneous grid. You can also consider multiple gradient in order to control each line alone and build a custom grid.