html - 使用 iframe 垂直滚动

标签 html css iframe

代码:

<iframe id="mainiframe" name="mainiframe"  src="path" style="width: 100% !important;height:700px;"
 scrolling="yes" frameborder="0">
</iframe>

当 iframe 的内容超过它的高度时,它会在 iframe 内显示滚动条,但我希望在浏览器上有相同的滚动条。

浏览器滚动条怎么办?

最佳答案

另一个解决方案是添加一个 100% 的 CSS 高度属性加上一个额外的底部边距像素来强制滚动条,例如。

html, body {
height: 100%;
margin: 0 0 1px;
}

关于html - 使用 iframe 垂直滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10636406/

相关文章:

javascript - css 转换不适用于 firefox

html - 针对不同平台调整图像大小

javascript - 导航栏和滚动 jQuery 出现问题

html - 垂直中文文本元素漂浮在标签旁边

html - CSS 位置 :Overflow issue

css - 我可以只使用 CSS 更改图像标签的 SVG "xlink:href"吗?

javascript - 通过从父 div 中减去另一个子 div 的高度来计算子 div 的高度

javascript - Iframe 中的滚动条在内容之前结束。那么有没有办法将滚动条高度设置为内容的高度

javascript - Jquery - 拦截在 iframe 中点击的链接

javascript - 为什么 javascript 不能改变 iframe 的 dom,但浏览器工具可以?