关于我在箭头图标上设置的 anchor 标签,我的投资组合网站遇到了问题。似乎我在启动画面上设置的第一个箭头移动到下一个部分。我设置的其他两个箭头不会移动到页面上的下一个部分/div。我不确定是什么导致了这种情况发生,因为我已经为我将在第二个和第三个按钮的 anchor 标记中引用的 div 设置了 id。
箭头 2
<div id="snap" class="bounce arrow">
<a href="#featproject">
<i class="fa fa-chevron-circle-down fa-5x" aria-hidden="true"></i>
</a>
</div>
<!-- Carousel of Projects -->
<div class="row featuredprojects" id="featproject">
<div class="col-md-12">
<h2><u>Featured Projects</u></h2>
</div>
</div>
箭头 3
<div id="snap" class="bounce arrow">
<a href="#contact">
<i class="fa fa-chevron-circle-down fa-5x" aria-hidden="true"></i>
</a>
</div>
<div class="contact" id="contact">
<button id="contact_button" class="unstyled-button contact-button" data-modal-type="modal-8" >Contact</button>
</div>
样式.css
* {
box-sizing: border-box;
padding: 0;
margin: 0;
border: 0;
}
html,body
{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
body {
background-color: #fafaf6; /* #fafaf6 */
color: black;
overflow-y: scroll;
scroll-behavior: smooth;
}
header {
height: 100vh;
margin-bottom: 10px;
background: url("../img/splashscreen.jpg") no-repeat center center;
background-size: cover;
display: flex;
flex-direction: column;
}
.header-container{
padding-right: 110px;
padding-left: 220px;
color: #40E0D0;
}
.arrow{
text-align: center;
margin-bottom: 20px;
}
.bio{
font-size: 15px;
text-align: center;
}
.bio-section{
height: 100vh;
}
.featuredprojects{
background-image: url("../img/coding.jpg");
height: 100vh;
color: #40E0D0;
}
.contact{
text-align: center;
padding-top: 300px;
height: 100vh;
background-color: #40E0D0;
}
注意:抱歉缩进,这是我第一次真正在 StackOverflow 上发帖。我编辑了代码不需要的注释。我在我的代码中重构了启动画面,我把它放在一个标题标签中,并注意到那是那些按钮坏了的时候。我在下面包含了我的 GitHub。
GitHub:https://github.com/adamdevelops/adamdevelops.github.io
最佳答案
通过删除 x-overflow 和 y-overflow 的 html、body 和 body 样式属性解决。这样做之后, anchor 标记按钮将移动到具有特定 id 的下一个 div。
关于html - 为什么我的 anchor 标签不移动到 div 目标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50595099/