2015-06-22 85 views
0

當我嘗試在iPhone設備上的iframe中打開鏈接時,默認情況下它會將src url的寬度設置爲980像素。默認情況下iphone5上的iframe問題將寬度設置爲980 px

<iframe 
    width="100%" 
    height="700" 
    frameborder="0" 
    marginheight="0" 
    marginwidth="0" 
    scrolling="yes" 
    src="http://example.com" 
    style="overflow: hidden; margin: 0px;"> 
</iframe> 

回答

0

將你的iFrame包裝在一個帶有類視頻包裝的div中。然後把這個在你的CSS:

.videoWrapper { 
position: relative; 
padding-bottom: 56.25%; /* 16:9 */ 
padding-top: 50px; 
height: 0; 
} 
.videoWrapper iframe { 
    position: absolute; 
    top: 0; 
    left: 5%; 
    width: 90%; 
    height: 90%; 
} 

希望幫助!

相關問題