简体   繁体   English

使用iframe进行垂直滚动

[英]vertical scrolling using iframe

code : 代码:

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

It will display scroll inside iframe when content of iframe exceeds it's height But i want same scroll on browser. 当iframe的内容超过其高度时,它将在iframe中显示滚动条,但是我想在浏览器上进行相同的滚动。

What to do for browser scroll bar ? 浏览器滚动条该怎么做?

Another solution to this is to add a CSS height property of 100% plus an extra bottom margin pixel to force the scrollbar eg. 对此的另一种解决方案是添加100%的CSS height属性,再加上一个额外的底部空白像素来强制滚动条。

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

I'm not sure I'm understanding completely - a browser has that functionality automatically. 我不确定我是否完全了解-浏览器会自动具有该功能。 You might be looking for the CSS overflow-y: scroll which will force the scrollbar always. 您可能正在寻找CSS overflow-y: scroll ,将始终强制滚动条。

You'll want to put that like so: 您将想要这样放置:

html {
  overflow-y: scroll;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM