.divContainer{ display: flex; flex-direction: column; } .rowDivContainer{ display: flex; border: 1px solid green; width: 500px; justify-content: space-around; } .divElem{ height: 30px; width: 30px; border: 1px solid green; } .colorChange{ background-color: red; border: 1px solid green; height: 30px; width: 30px; }