86
rated 0 times
[
91]
[
5]
/ answers: 1 / hits: 20982
/ 6 Years ago, wed, january 24, 2018, 12:00:00
I'm trying to create a grid of squares to provide some navigation features.
Squares meaning that the width and height of the colored areas will be equal.
I have it working with js, but I would prefer a CSS only solution. I'm working with bootstrap.
<div class="container">
<div class="row">
<div class="col-4" style="background-color: lightgray"></div>
<div class="col-4" style="background-color: lightgreen"></div>
<div class="col-4" style="background-color: lightgray"></div>
<div class="col-4" style="background-color: lightgreen"></div>
<div class="col-4" style="background-color: lightgray"></div>
<div class="col-4" style="background-color: lightgreen"></div>
</div>
</div>
var divs = $(".row > div");
var width = divs.width();
divs.height(width)
How can I achieve this with css only?
More From » jquery