Home > DeveloperSection > Forums > Making an iframe take vertical space
Pravesh Singh

Total Post:411

Points:2881
Posted on    February-13-2013 2:07 AM

 CSS-CSS3 CSS-CSS3 
Ratings:


 1 Reply(s)
 927  View(s)
Rate this:

Hi!

I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible ?

Are there any workarounds?

Thanks in advance



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    February-13-2013 8:08 AM

Hi Pravesh!

This should set the IFRAME height to its content's height:

<script type="text/javascript">
       var height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
       document.getElementById('the_iframe').height = the_height;
</script>


You may want to add scrolling="no" to your IFRAME to turn off the scrollbars.


Don't want to miss updates? Please click the below button!

Follow MindStick