Three Column Website Layout in CSS

Now let's make a three-column layout. Here's an example of what we should get:

First, let's write the structure of the site:

html<div id="wrapper">
  <div id="header">
    header
  </div>
  <div id="container">
    <div id="left">
      left sidebar
    </div>
    <div id="content">
      content
    </div>
    <div id="right">
      right sidebar
    </div>
  </div>
  <div id="footer">
    footer
  </div>
</div>

Let's set the width of the wrapper and center it:

css#wrapper {
  width: 1100px;
  margin: 30px auto;
  border: 1px solid black;
}

Let's put the container blocks in a row:

css#container {
  display: flex;
}

Now let's assign the widths of the blocks so that in total they give the width of the wrapper:

css#content {
  width: 700px;
}
#left {
  width: 200px;
}
#right {
  width: 200px;
}

Let's now add margin, pinching their width from the content:

css#content {
  width: 660px;
}
#left {
  width: 200px;
  margin-right: 20px;
}
#right {
  width: 200px;
  margin-left: 20px;
}

Let's add the rest of the styles:

css#content {
  width: 660px;
  height: 700px;
  padding: 20px;
  border: 1px solid black;
}
#left {
  width: 200px;
  margin-right: 20px;
  padding: 20px;
  border: 1px solid black;
}
#right {
  width: 200px;
  margin-left: 20px;
  padding: 20px;
  border: 1px solid black;
}

Let's write the final code:

html<div id="wrapper">
  <div id="header">
    header
  </div>
  <div id="container">
    <div id="left">
      left sidebar
    </div>
    <div id="content">
      content
    </div>
    <div id="right">
      right sidebar
    </div>
  </div>
  <div id="footer">
    footer
  </div>
</div>
css* {
  box-sizing: border-box;
}

#wrapper {
  width: 1100px;
  margin: 30px auto;
  border: 1px solid black;
}
#header {
  height: 200px;
  padding: 20px;
  border: 1px solid black;
}
#container {
  display: flex;
}
#content {
  width: 660px;
  height: 700px;
  padding: 20px;
  border: 1px solid black;
}
#left {
  width: 200px;
  margin-right: 20px;
  padding: 20px;
  border: 1px solid black;
}
#right {
  width: 200px;
  margin-left: 20px;
  padding: 20px;
  border: 1px solid black;
}
#footer {
  height: 200px;
  padding: 20px;
  border: 1px solid black;
}
Задание 1
Задание 2
Задание 3