html - 为什么我的锚标签没有移动到 div 目标?
问题描述
关于我在箭头图标上设置的锚标签,我的投资组合网站遇到了问题。我在初始屏幕上设置的第一个箭头似乎移到了下一部分。我设置的其他两个箭头不会移动到页面上的下一部分/div。我不确定是什么导致了这种情况发生,因为我已经为我将在第二个和第三个按钮的锚标签中引用的 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 样式属性解决。这样做之后,锚标记按钮将移动到具有特定 id 的下一个 div。
推荐阅读
- android - 推广封闭测试轨道时,Google Play 会自动发布到生产环境吗?
- java - 我可以默认将方法的参数设为 null 吗?
- assembly - 在 x86 程序集中生成伪随机字符
- python - 如何保存 np.append 成为像这张图片一样的列
- ios - 如何在 Swift 的 tableview 中添加 AdMob Native 广告(使用故事板)
- c# - 用文本替换 if number 语句
- android - C++,Android NDK:如何将我的原始音频数据正确保存到文件并再次加载
- recursion - 动态规划解决fibwords问题
- angular - 如何在 Web 组件中使用服务
- java - 如何在我的 2D Array 程序中修复此变量错误?