my CSS Grid should have a specified width of 70vw.
But when I add column-gap to the grid, it becomes larger than 70vw.
What is the solution, to avoid that?
button{
width:100%;
}
.grid-container{
width:70vw;
border:1px black solid;
display:grid;
grid-template-columns:33.3% 33.3% 33.3%;
justify-items:stretch;
}
.not-wanted{
column-gap:10%;
}
Grid fits to the specified width :)
<div class="grid-container">
<div><a href=""><button>Grid-Child 1</button></a></div>
<div><a href=""><button>Grid-Child 2</button></a></div>
<div><a href=""><button>Grid-Child 3</button></a></div>
</div>
<br>
Grid doesn't fit to the specified width :(
<div class="grid-container not-wanted">
<div><a href=""><button>Grid-Child 1</button></a></div>
<div><a href=""><button>Grid-Child 2</button></a></div>
<div><a href=""><button>Grid-Child 3</button></a></div>
</div>