setting the height of a Div with an html iframe inside

I have this fiddle

I have an iframe inside a Div. The div has a blue border and the iframe has a red border.

I set the height of the div to 100% percent and the height of the iframe to 100%.

When i run it, the div isn't taking up the full 100% height of the browser window.

How do i fix my fiddle so that the height of the div and iframe inside stretch the full height of the window?

As pointing by this arrow in this image:

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
That is because an iframe is a new web page and by default the body tag has a margin.

Add this to the <head> of your iframe page

body {
   margin: 0;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sam JacobsDirector of Technology Development, IPMCommented:
It's not the iFrame ... it's the DIV, which isn't stretching to 100% because you also need to set its parent's height to 100%.
You can do this by adding the following to the <style> section::
body { 
height: 100%;

Open in new window

Chris MichaelidesCEO & FounderCommented:
CSS height can't take a percentage value like this.
If you want your div to take up the full height of the browser window, you have to set it like this:

        #Div1 {
            border: 1px solid #0000FF;
            height: 100vh;

Open in new window

maqskywalkerAuthor Commented:
thanks experts.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.