Full Width Divs

by greatCar

HTML

<p>Create a div that stretches across the window, with a 50px gap between both sides of the div and the edges of the window:</p>
<div id="div1">
<div id="div2">more t222222ext

</div>


<div id="div4" >more 4444

</div>

</div>

CSS

#div1 {
    position: absolute;
    left: 50px;
    width: calc(100% - 100px);
    background-color: yellow;
    padding: 0px;
    text-align: center;
    height: 400px;
}
#div2 {
    position: relative;
     width: calc(100%);
  border: 1px solid black;
    background-color: blue;
height: 100px;
    text-align: center;
}

#div4{
    position: relative;
      width: calc(100%);
  border: 1px solid black;

height: 100px;
    text-align: center;
    background-color: green;

    text-align: center;
}