ال Code الموجود في الدرس
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>CSS</title>
<link rel="stylesheet" href="css/master.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="parent">
<div class="center-position circle-100 center-flex">Child</div>
</div>
<div class="product center-position circle-200 center-flex">Product</div>
</body>
</html>
/*
Create Your Framework
*/
* {
box-sizing: border-box;
margin: 0;
}
.parent {
position: relative;
background-color: #eee;
margin: 20px auto;
width: 1200px;
height: 200px;
}
.parent div {
background-color: green;
color: white;
}
.product {
background-color: red;
color: white;
}
.center-position {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.circle-100 {
width: 100px;
height: 100px;
border-radius: 50%;
}
.circle-200 {
width: 200px;
height: 200px;
border-radius: 50%;
}
.center-flex {
display: flex;
justify-content: center;
align-items: center;
}
.border-r {
border-radius: 4px;
}