Hello everyone, I need help with a school project where I have to make blocks responsive and change their layout based on screen width. Specifically, above 1024px they should be in 2 horizontal rows, and below 1024px in 2 vertical rows, always spelling out 'LOI'. I've managed to achieve this using flexbox and a media query to change the flex-direction. However, now I want the blocks to be truly responsive so that there are no gaps between them when resizing the screen. Does anyone know how to accomplish this? Thank you!
main {
max-width: 1024px;
margin: auto;
}
.blokken {
display: flex;
flex-wrap: wrap;
flex-direction: column;
max-height: 1200px;
align-content: stretch;
}
@media screen and (min-width: 1024px) {
.blokken {
flex-direction: row;
}
}
.letter {
width: 300px;
height: 300px;
margin: 5px;
background-color: #eee;
border: 5px solid black;
font-family: sans-serif;
font-size: 5em;
color: black;
display: flex;
justify-content: center;
align-items: center;
border-radius: 25%;
overflow: hidden;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Netherlands Urbanized</title>
</head>
<body>
<main>
<h2 id="letterblocks">Letter Blocks</h2>
<div class="blocks">
<div class="letter">L</div>
<div class="letter">O</div>
<div class="letter">I</div>
<div class="letter">L</div>
<div class="letter">O</div>
<div class="letter">I</div>
</div>
</main>
</body>
</html>