html - 为什么我的 anchor 标签不移动到 div 目标?

标签 html css

关于我在箭头图标上设置的 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/

相关文章:

javascript - XML 文档可以支持 HTML 表单吗?

html - 如何实现schema.org containedIn?

子元素的 CSS 选择器

javascript - 显示并停留在鼠标悬停上的 Div - 即使在鼠标悬停时也保持悬停状态

html - 调整图像大小以填充但不超过浏览器窗口的最优雅方法?

javascript - 如何使用javascript事件从angularjs指令范围传回值

css - 当上面DIV的高度大于X时, float 的div下降

jquery - Style Span 和 Jquery

jquery - 滚动时降低div的高度

css - 虚线下划线无法在 Chrome 中正确呈现