.container > div { display: flex; justify-content: center; align-items: center; font-size: 2em; color: #ffeead; } html, body { box-sizing: border-box; background-color: #ffeead; height: 100%; padding: 10px; margin: 0px; } .container > div:nth-child(1n) { background-color: #96ceb4; } .container > div:nth-child(3n) { background-color: #88d8b0; } .container > div:nth-child(2n) { background-color: #ff6f69; } .container > div:nth-child(4n) { background-color: #ffcc5c; }