【问题标题】:How to make iFrame scroll with the background?如何使 iFrame 随背景滚动?
【发布时间】:2014-05-06 05:43:26
【问题描述】:
我设计了一个网页,我在其中使用了填充背景的图像
我正在使用一个实际上包含内容的 iFrame。
我已将其放置在背景图像就像主要内容 (iFrame) 的边框的方式中。
现在,问题是当我滚动 iFrame 时,背景保持静止,而当我滚动背景时,iFrame 保持静止。
我想同时滚动两者;
或者,如果有一种方式,背景根本不滚动,而 iFrame 使用专为网页设计的浏览器主滚动条滚动。
任何建议或意见都将非常值得赞赏!
谢谢!
【问题讨论】:
标签:
html
css
scrollbar
webpage
【解决方案1】:
为什么要使用 iframe?你在寻找类似this fiddle 的东西吗?
这将允许主要内容与背景一起滚动:
html:
css:
body {
background: url(images/full_screenBgImage.jpg) no-repeat transparent;
background-attachment: fixed;
background-position: bottom left;
}
#mainContent {
background-color: white;
padding: 10px;
width:50%;
margin:20px auto;
}