Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iFrame 100% height minus header [closed]

Tags:

html

css

iframe

I have an iframe with a height of 100% along with a div that sits above (height is 70px). The iframe overflows the page, but I want to be able to have the 100% height minus 70px so as that the scrollbar for the iframe fits into the page.

enter image description here

like image 595
Harry Avatar asked Feb 06 '13 19:02

Harry


1 Answers

Okay, so I figured it out. I just added a parent div around the iframe.

<div class="parent">
    <iframe src="http://reddit.com"> </iframe>
</div>


.parent{
    margin-top: 70px;
    position: absolute; 
    top: 0px; 
    left: 0px;
    right: 0px; 
    bottom: 0px;
}

iframe{
    position:absolute; 
    width: 100%;
    height: 100%;
    border: 0px;
}
like image 161
Harry Avatar answered Sep 29 '22 00:09

Harry