【问题标题】:Not able to scroll simple html page无法滚动简单的html页面
【发布时间】:2022-09-27 14:30:02
【问题描述】:

我的 CSS 代码遇到了问题,使用 overflow-y: scroll;该页面应该是可滚动的,但它不是。我用 lorem ipsum 填充了页面站点,因此滚动条应该有足够的内容。这是我的代码:

body {
  background-color: rgb(65, 75, 100);
  background-position: 0 0;
  background-repeat: repeat;
  background-size: cover;
  overflow-y: scroll;
}
<nav>
  <button type=\"button\" id=\"btn1\">
            <a href=\"contact.html\">contact</a>
          </button>
  <!---->
  <div class=\"dropdown\">
    <button type=\"button\" id=\"btn2\" class=\"dropbtn\">
              <a class=\"material-symbols-rounded\">menu</a>
            </button>
    <div class=\"dropdown-content\">
      <p><a href=\"index.html\">Home</a></p>
      <p><a href=\"overmij.html\">Over mij</a></p>
      <p><a href=\"mijnprojecten.html\">Mijn projecten</a></p>
      <p><a href=\"contact.html\">Contact</a></p>
    </div>
  </div>
</nav>
<div>
  <h1 id=\"mijnportfolio\">MIJN PORTFOLIO</h1>
</div>
<style></style>
<h3 id=\"loremipsum\">
  /* lorem ipsum here */
</h3>
<div class=\"footer\">
  <p>footer</p>
</div>
  • 它仍然需要足够的内容才能实际滚动,否则滚动条将在那里但处于非活动状态。这个例子中的 HTML 是什么样子的?
  • 尝试将min-height 添加到大于100vh 的体内elemint
  • 您的 HTML 外观如何,需要更多信息来回答问题。
  • 您的代码似乎对我有用。 (另外,&lt;a&gt; 内的 &lt;button&gt; 是无效的 HTML)

标签: html css


【解决方案1】:

<style>
   body {
 background-color: rgb(65, 75, 100);
 background-position: 0 0;
 background-repeat: repeat;
 background-size: cover;
 overflow-y: scroll;
 min-height: 1200px;
}
</style>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多