我很难说出这个问题,因为我不知道正确的术语。我正在尝试创建一个网站,以便在滚动主要内容时,它不会滚动页面。我希望主要内容在页面中间的某处结束,以免覆盖我的“固定”背景图像。但我不想要一个iframe。换句话说,它看起来有点像iframe,但它应该由主滚动条控制。
无论如何,我希望这是有道理的。我很感激你的建议。
答案 0 :(得分:0)
您是否已使用background-attachment: fixed;
?
或者overflow-y: scroll;
带有div?
答案 1 :(得分:0)
您想在HTML的块中显示滚动条,对吧?尝试使用CSS overflow属性。
参考:www.w3schools.com/css/pr_pos_overflow.asp
在页面代码中尝试此操作:
<style type="text/css">
<!--
div.scroll {
height: 200px;
width: 300px;
overflow: auto;
border: 1px solid #666;
background-color: #ccc;
padding: 8px;
}
-->
</style>
<div class="scroll">
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
<p>This is a scrolling are created with the CSS property overflow.</p>
</div>
这是你要做的吗?
答案 2 :(得分:0)
可以使用两个覆盖顶部和底部的<div>
,以便您的文字位于其下方。
+----------------+
|+--------------+|
|| top ||
|+--------------+|
| your text |
| text |
|+--------------+|
|| bottom ||
|+--------------+|
+----------------+
在z-index
上,top
和bottom
将位于主图层上,并且它们将位于fixed
左上角和左下角角。