Create index.html file
<!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">
<title>Document</title>
</head>
<body>
<div class="parent1">
<div class="child1"></div>
</div>
<div class="parent2">
<div class="child2"></div>
</div>
<div class="parent3">
<div class="child3"></div>
</div>
</body>
</html>
create index.css
.parent1{
border: 1px solid red;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
}
.child1{
width: 50px;
height: 50px;
background: red;
}
.parent2{
border: 1px solid green;
height: 100px;
display: grid;
place-items: center;
}
.child2{
width: 50px;
height: 50px;
background: green;
}
.parent3{
border: 1px solid blue;
height: 100px;
}
.child3{
margin: 25px auto;
width: 50px;
height: 50px;
background: blue;
}
Comments
Post a Comment