its driving me crazy on which way is better to space out items inside a container
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flexbox</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="f">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
</div>
</body>
</html>
should i do it like
* {
margin: 0px;
padding: 0px;
}
#f {
border: 1px solid blue;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
align-content: flex-start;
width: 100%;
min-height: 100vh;
padding: 10px;
}
#f div {
border: 1px solid red;
width: 300px;
height: 300px;
margin: 20px;
}
#f div:nth-child(1) {
background-color: aquamarine;
}
#f div:nth-child(10) {
background-color: aqua;
}
with margin doing the spacing or like this with gap
* {
margin: 0px;
padding: 0px;
}
#f {
border: 1px solid blue;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
align-content: flex-start;
width: 100%;
gap: 20px;
min-height: 100vh;
padding: 10px;
}
#f div {
border: 1px solid red;
width: 300px;
height: 300px;
}
#f div:nth-child(1) {
background-color: aquamarine;
}
#f div:nth-child(10) {
background-color: aqua;
}