IFrame height issues on iOS (mobile safari)

前端 未结 3 687
温柔的废话
温柔的废话 2020-12-29 04:58

Example page source:




    
    

        
3条回答
  •  轮回少年
    2020-12-29 05:22

    PROBLEM:

    I was having the same issue. Sizing/styling the iframe's container div and adding scrolling="no" to the iframe didn't work for me. Having a scrolling overflow like Freya describes wasn't an option, either, because the contents of my iframe needed to size depending on the parent container. Here's how my original (not working, overflowing its container) iframe code was structured:

    
    
    

    SOLUTION:

    This super simple little CSS hack did the trick:

    
    
    

    Set the iframe's height/width to some small, random pixel value. Set it's min-height & min-width to what you actually want the height/width to be. This completely fixed the issue for me.

提交回复
热议问题