What is the best way to set the height of an iframe at 100%?

2

Personal what would be the best way to set the height of a iframe to 100%? I have tried with Height=100% owned by HTML itself (although it is not advisable after HTML5 and CSS itself), and I also tried to define a style sheet height:100%; .

I've tried the forum but found no similar solution.

    
asked by anonymous 18.08.2015 / 23:09

1 answer

2

I found the solution in the international forum itself: How to set the iframe height & width to 100%

The best solution is through CSS, but an important observation is that it is necessary to modify the value of the tag html and body also with height 100%, and the position itself also influences, all less relative works.

The code would look like this:

html,body        {height:100%;}
.h_iframe iframe {position:absolute;top:0;left:0;width:100%; height:100%;}
<div class="container">
    <div class="h_iframe">
        <iframe  src="//www.youtube.com/embed/9KunP3sZyI0" frameborder="0" allowfullscreen></iframe>
    </div>

</div>
    
18.08.2015 / 23:20