Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IFRAME Fit entire content no scroll bar

Hello well I can not get my IFRAME to work. I want its height to fit the entire content area. When I put height 100% it does not fit the entire area and only fits about 3/4s of the content area. Here is my code:

<iframe src="some.html" frameborder="0" style="overflow:hidden; display:block; height:100%; width:100%" height="100%" width="100%">
<p style="">Your browser does not support iframes.</p>

How can I fit entire content are on my iframe?

like image 545
user3264162 Avatar asked Feb 16 '14 22:02

user3264162


People also ask

How do I get rid of the scroll bar in iframe?

A simpler way is however, is to use a container div styled with overflow: hidden; to hide the scrollbar. Set the width and the height of the div, to be slightly less than that of your iframe. Hope this helps you.

How can I hide scrollbar in iframe but still scroll?

1. Set the overflow of the parent div as hidden. 2. Set the overflow of the child div to auto and the width 200% (or anything more than 100%, or more than the width of the parent - so that the scrollbar gets hidden).

Why does my iframe have a scroll bar?

Content that is presented in an iFrame appears with a vertical scrollbar if the length of the child document exceeds the height of the iFrame and with a horizontal scrollbar if the child document elements won't wrap to the width of the iFrame.


1 Answers

Use this in your code, your problem was that it had to be set to position: absolute, otherwise it'll just give you the width and height you need.

 <body style="margin: 0 auto;">
        <iframe src="some.html" frameborder="0" 
         style="overflow:hidden; 
         display:block; position: absolute; height: 100%; width: 100%">
<p style="">
         Your browser does not support iframes.
</p>
</body>
like image 95
BruceWayne Avatar answered Sep 27 '22 22:09

BruceWayne