删除position: fixed; 的#content
#content {
padding: 60px 0;
}
还有来自body的overflow-y: hidden;
html, body {
height: 100%;
margin: 0 auto;
color: #4c4c4c;
overflow-x: hidden;
text-align: center;
}
最后从.words删除overflow-y: scroll;
.words {
text-align: left;
margin: 0 20px 0 20px;
}
这应该可以解决您的问题,如果有帮助,请告诉我!
编辑 1
所以首先我们需要更新标记,让我们创建一个新的容器 div 并给它类.new-header,这需要在#content div 之外
<div class="new-header">
<a class="hoverontouch" href="https://www.dollarresources.com">
<div class="worldwide grow WorldWide">
</div>
</a>
<div class="search-bar">
<div class="search-button">
<form action="search_keyword.php">
<input type="text" name="keyword" placeholder="Search Dollar Resources..." required oninvalid="this.setCustomValidity('Please enter a search word or phrase')"
oninput="setCustomValidity('')" autocomplete="off" onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Search Dollar Resources...'">
<button type="submit" value="Submit"><i class="fa fa-search"></i></button>
</form>
<?php
// include "search_keyword.php";
$mysqli->close();
?>
</div>
</div>
</div>
如您所见,在 .new-header div 中,您拥有第二个标头所需的所有信息,然后您需要添加此 css
.new-header{
position: fixed;
top: 40px;
width: 100%;
background-color: #fff;
}
现在我们需要给#content div 更多的padding-top
#content {
padding: 170px 0 60px 0;
}
如果您在应用此方法时遇到任何问题,请告诉我。