Reputation: 171351
Vertical grid can be achieved by:
HTML:
<div class="vertical-grid">
</div>
CSS:
.vertical-grid {
background-size: 20px 100%;
background-image: linear-gradient(to right,
black 0%,
transparent 5%,
transparent 100%);
}
Horizontal grid can be achieved by:
HTML:
<div class="horizontal-grid">
</div>
CSS:
.horizontal-grid {
background-size: 100% 10px;
background-image: linear-gradient(to bottom,
black 0%,
transparent 7%,
transparent 100%);
}
Is that possible to have both grids on the same element?
HTML:
<div class="vertical-grid horizontal-grid">
</div>
CSS:
[Enter your answer here]
Upvotes: 1
Views: 4441
Reputation: 171351
Here is a possible solution using multiple backgrounds:
.vertical-grid.horizontal-grid {
background-size: 20px 100%, 100% 10px;
background-image: linear-gradient(to right,
black 0%,
transparent 5%,
transparent 100%),
linear-gradient(to bottom,
black 0%,
transparent 7%,
transparent 100%);
}
Upvotes: 2