Column Flex,Child iframe 100% height,the parent scroll is shown

Viewed 239

in the div have height 100% iframe,the parent shown Y scroll.why it overflow?

.root{
  position:absolute;
  height:100%;
  width:100%
}
iframe {
  pointer-events: all;
  width: 100%;
  height: 100%;
  border: 0;
  overflow-y: hidden !important;
  overflow-x: hidden !important;
  overflow: hidden;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>

<div class="d-flex flex-column root">
  <div style="background:yellow">
  Head
  </div>
  <div class="flex-grow-1 overflow-auto">
    <iframe frameborder="0" allowfullscreen src="https://www.portotheme.com/"></iframe>
  </div>
</div>

the iframe set to height:100%.why the parent show scroll? JSFiddle.

1 Answers

Add to overflow-y property to root class. That is, overflow-y: hidden;

.root{
  overflow-y: hidden;
}

changes in HTML

<div class="d-flex flex-column root">
  <div style="background:yellow">
  Head
  </div>
  <div class="h-100">
    <iframe frameborder="0" allowfullscreen src="https://www.portotheme.com/"></iframe>
  </div>
</div>

Codepen demo

JSFiddle demo

Related