<div>
<iframe src="test.html" width="400px" height="300px" ></iframe>
</div>
test.html
<html>
<head></head>
<body>
<div></div>
</body>
</html>
需要在iframe外面的div以及iframe里面页面的html,body都要加上
overflow: auto;
-webkit-overflow-scrolling: touch;
这样可以出现滚动条,
说明:
需要给iframe的父元素设置独立区域可滚动,-webkit-overflow-scrolling: touch;,但同时还需要设置以下属性才可以:
1. -webkit-overflow:auto;
2.父元素的宽和高,还必须设置成绝对的像素,百分比是不可以的。