下面是正在发生的事情的图片示例。为什么我的按钮溢出到另一个页面?
我试图建立一个与页面滚动网站之一。
白色背景表示一页,灰色背景表示另一页的开头。
当我开始用内容填充我的白页时,我注意到我的按钮缓慢地开始向下滑动,现在正侵入灰色页面。我不希望这种情况发生,而是为了延长白页。
这里是我的网页CSS:
#white-page
{
background-color: white;
height: auto;
min-height: 100vh;
text-align: center;
}
#grey-page
{
background-color: grey;
min-height: 100vh;
}
这里是我的按钮CSS。
.download-center
{
text-align: center;
margin-top: 60px;
}
.btn
{
text-decoration: none;
border: 1px solid gray;
padding: 10px 20px 10px 20px;
border-radius: 25px;
color: inherit;
}
下面是相关HTML
<section id="white-page">
//page content here
<div class="download-center">
<a class="btn font-r" href="docs/resume.pdf" target="_blank">
<img id="download-pic" src="pic/download.svg" />Download Résumé
</a>
</div>
</section>
<section id="grey-page">
//page content here
</section>
我试过白色页面的高度设置为auto
,但它似乎并没有工作。
基本上,我只是希望页面能够根据内容的需要进行扩展,但至少需要vh
,以便它首先占据整个屏幕。
编辑:通过删除margin-top
属性,这里是结果。它所做的只是将按钮靠近我的内容,但仍然侵犯了页面边界。
你能提供生活的例子吗? –
你能显示html吗?可能是该按钮位于具有“position:absolute”的div内;' –
尝试从.download-center css – Nir