This is a very interesting problem and you can notice with it how sometimes working with height can be fun.
Since you want a chess-like layout, we responsibly cannot guarantee that by decreasing the screen the squares will be positioned exactly as we specified. An easy way to achieve this is by using .d-flex .flex-wrap
bootstrap in a container. Then the 8 items will hold their position with a width calc(100% / 8)
which is 12.5% block width. But that doesn’t solve the problem, because it depends on how you want the shape of chess to look, whether it decreases the number of columns or not.
About height, you can do a view-port study and analyze what would be the best way to define it. Then make the modifications by media queries.
A basic example that I set up and can help you:
.item-line {
height: 138.75px;
}
.item-box {
position: relative;
float: left;
width: 12.5%; /* calc(100% / 8)*/
height: 100%;
padding: 0;
}
.item-line:nth-child(even) .item-box:nth-child(even) {background: lime}
.item-line:nth-child(even) .item-box:nth-child(odd) {background: fuchsia}
.item-line:nth-child(odd) .item-box:nth-child(even) {background: fuchsia}
.item-line:nth-child(odd) .item-box:nth-child(odd) {background: lime}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="d-flex flex-wrap item-line">
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
</div>
<div class="d-flex flex-wrap item-line">
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
</div>
<div class="d-flex flex-wrap item-line">
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
</div>
<div class="d-flex flex-wrap item-line">
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
<div class="item-box">Flex item</div>
</div>
</div>
Are you using Bootstrap 3 or 4? By the classes of your code I think 4, but you put the tag
Bootstrap-3
on the question... you need to make sure which version you are using!– hugocsl