ال Code الموجود في الدرس
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>CSS</title>
<link rel="stylesheet" href="css/master.css" />
</head>
<body>
<div class="parent">
<div class="one"></div>
<div class="two">
<div class="up"></div>
<div class="down"></div>
</div>
</div>
</body>
</html>
/*
The Margin Collapse
[1] Only Vertical Margin Collapse
[2] Bigger Margin Wins
[3] Margin Collapsing With Elements Without Anything Between
[4] Nesting Does Not Prevent Collapse
*/
.parent {
overflow: hidden;
margin: auto;
width: 400px;
height: 200px;
padding: 10px;
background-color: #eee;
}
.parent .one,
.parent .two {
float: left;
width: 50%;
height: 100%;
}
.one {
background-color: #ddd;
}
.two {
background-color: #aaa;
}
.up {
background-color: red;
color: white;
height: 80px;
margin-bottom: 40px;
}
.down {
background-color: green;
color: white;
height: 80px;
margin-top: 40px;
}