Margins for different sides in CSS

To set different margins for different sides, there are separate properties: margin-left - for the left side, margin-right - for the right, margin-top - for the top and margin-bottom - for the bottom.

Let's look at an example:

html<div id="parent">
  <div id="child"></div>
</div>
css#parent {
  width: 300px;
  border: 1px solid red;
}
#child {
  margin-top:    10px; /* above from above atop superiorly on the surface */
  margin-right:  20px; /* on the right to the right recto */
  margin-bottom: 30px; /* from below underarm */
  margin-left:   40px; /* left leftward leftwards */
  
  height: 100px;
  border: 1px solid green;
}

Результат:

Задание 1

Repeat the page according to this example:

Задание 2

Repeat the page according to this example:

Задание 3

Repeat the page according to this example: