HTML CODE :
<!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>Grid With Spacing Around</title>
</head>
<body>
<div class="grid">
<div class="box item1">
Step Towards Coding
</div>
<div class="box item2">
Grid by using space-around and space-between
</div>
<div class="box item3">
Share With your friends
</div>
<div class="box item4">
HTML CSS
</div>
<div class="box item5">
Keep Coding
</div>
</div>
</body>
</html>
CSS CODE :
html {
box-sizing: border-box;
}
*, *::before, *::after {
box-sizing: inherit;
}
body {
margin: 50px;
}
.grid {
margin: 0 0 30px 0;
width: 700px;
height: 450px;
border: 3px solid #ed6b5b;
display: grid;
gap: 10px;
grid-template-columns: repeat(4, 80px);
grid-template-rows: repeat(3, 100px);
align-content: space-around;
justify-content: space-between;
}
.box {
background-color: #3a3e59;
color: #f9ac66;
border-radius: 6px;
padding: 15px;
font-size: 140%;
}
.item1 {
grid-column: 1 / 5;
}
.item2 {
grid-column: 1 / 3;
grid-row: 2 / 4;
}
.item3 {
grid-column: 3 / 5;
}

0 Comments
Ask Your Queries in the comments