Search code examples
htmliframescrollscrollbar

Force iframe to scroll


I have an absolutely horrible webform that renders into the following:

body -> form -> table -> thousands of divs -> iframe -> body -> thousands of divs -> iframe -> body -> table

Eventually I find the table that contains the actual data, the user makes his view smaller and the data cannot be seen, so there needs to be a scrollbar. I have been applying overflow:auto, width:100%, height:100% on many elements but never seen the right scrollbar to appear. Initially, the page renders with a few of the parent elements having overflow:hidden, however after changing them as I was inspecting the page nothing happened. Is there any way to force the scrollbar?


Solution

  • Please try this:

    <iframe src="p" width="300" height="500" scrolling="yes">
    </iframe>
    

    OR

    Put your iframe inside a fixed height div and put css property as scroll-y:auto.

    <div class="iframe_container">
    <iframe></iframe>
    </div>
    
    div.iframe_container{ height: 500px; overflow-y: scroll }