Use screen size at 100%

0

I have two divs,

DIV 1 with 80% width, centralized and I have the DIV 2 that is inside the DIV 1, I want it to be 100% wide, but since it is inside the DIV 1 that has 80% 100% becomes 100% of the DIV 1 (Turning 80%). But I want DIV 2 to have 100% of the width of the screen, even if it is inside DIV 1, can you do that?

<div class="1"> <!--TEM 80%-->
<div class="2"></div><!--TEM 100%, ou seja, pega o total da DIV1, mas quero que seja 100% da TELA TODA---->
</div>

    
asked by anonymous 19.05.2017 / 14:38

1 answer

2

Just add the position: absolute; property to <div class="2"> , followed by an example snippet:

#div1 {
  width: 80%;
  border: 1px solid green;
  height: 20px;
}

#div2 {
  width: 100%;
  border: 1px solid red;
  height: 20px;
  position: absolute;
}
<div id="div1">
  <div id="div2">
  </div>
</div>
    
19.05.2017 / 14:43