无法删除我的移动版本网站底部的空白

mfi*_*o31 3 html css mobile space

我尝试在此处查找此主题,没有任何答案可以回答我的特定问题。

问题是这样的:每次我进入网站的移动版本时,我都会第一次向下滚动到页面的最底部,这很好,我的背景图像充满了整个屏幕。但是随后我向上滚动并向下滚动,页脚下方突然出现一个白色条。我已经在CSS和HTML中尝试了很多东西,但到目前为止没有任何效果。

同样,此问题在我的桌面版本中不会发生,仅在我第二次向下滚动时在移动版本中才会发生。

这是我当前的CSS和HTML代码:

html,
body {
  background-image: url("https://i.pinimg.com/736x/46/c0/ab/46c0ab66409097e235b0\
93c469834848--ancient-egypt.jpg");
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
}

body,
main {
  display: flex;
}

body {
  flex-direction: column;
}

main {
  flex-direction: row;
  flex: auto;
}

article {
  flex: 2;
}

aside {
  flex: 1;
}

article,
aside {
  overflow-y: auto;
}

h1,
h2,
h3,
p {
  color: yellow;
}

a {
  color: yellow;
}

#header a,
#footer a {
  color: yellow;
}

#header a:hover,
#footer a:hover,
a:hover {
  color: white;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://www.holbertonschool.com/level2/holberton.css" rel="stylesheet">

<div id="header">
  <header>
    <ul>
      <li><a href="http://213.167.240.251/tweets.html">Ancient Egyptian Tweets</a></li>
      <li><a href="http://213.167.240.251/mummy.html">The Mummy</a></li>
      <li><a href="http://213.167.240.251/learn.html">Learn Hieroglyphics</a></li>
    </ul>
  </header>
</div>
<main>
  <article>
    <h1>The Ancient Egyptian Book of the Dead</h1>
    <h2>A Journey into the Afterlife</h2>
    <h3>By Mike Fierro (and the Ancient Egyptians, of course)</h3>
    <a href="https://www.youtube.com/watch?v=aPOFE-ZrqJg">
      <img src="http://www.crystalinks.com/papyrusofani.jpg">
    </a>
    <p>The Ancient Egyptian Book of the Dead: an ominous-sounding name for something so fascinating and yet, good. For the ancient egyptians, the Book of the Dead was not something to be feared, but cherished, and wanted. It contained spells, magic, and
      tips for getting around and staying safe in the afterlife.</p>

    <p>The ancient egyptian afterlife was something to be feared. In the picture shown above, the heart of the deceased is being weighed against the Maat, which is the Feather of Truth. If the heart outweighed the Feather of Truth, that meant the deceased
      had a heavy heart, filled with bad deeds and other shameful acts. At that point, the deceased's heart/soul was then thrown to the rather frightening monster on the right side of the picture, Ammit, who was part hippo, part lion, and part crocodile.
      Ammit would devour their soul and the deceased would have ceased to exist, which was more terrifying to the ancient egyptians than hell.</p>

    <p>However, if the deceased's heart weighed equal to, or lighter than the feather, then the deceased was granted a place in the Fields of Hetep and Iaru, their heaven. The god Horus would lead them to the great god Osiris, god of the Underworld, and
      Osiris would grant them their place in heaven for all eternity.</p>

    <p>Simply having this part of the Book of the Dead buried with you when you died would have pretty much guaranteed your entrance into heaven because the ancient egyptians believed in the power of illustrations and writings. They believed the illustrations
      would come to life in the afterlife, and so, if you had an illustration of your soul being successfully weighed against Maat, then they believed that that would, in fact, come true.</p>

    <p>Care to take a look at some of my juvenile ancient Egyptian-related tweets? Click <a href="http://213.167.240.251/tweets.html">here!</a></p>
  </article>
  <aside>
    <p>Placeholder to add comment thread later.</p>
  </aside>
</main>
<div id="footer">
  <footer>
    <p>Made by <a href="https://twitter.com/@RackRiderMike" target="_blank">Mike Fierro</a> for <a href="https://www.holbertonschool.com" target="_blank">Holberton Scho\
ol</a>.</p>
  </footer>
</div>
Run Code Online (Sandbox Code Playgroud)

这是我的问题的图片:

没有空格:

没有空格

带空格:

空白空间

任何帮助,不胜感激。谢谢!

小智 6

显然,这是旧的Chrome和Android错误。有几种方法可以尝试“避免”该错误。最简单的方法是在CSS的开头添加以下代码:

  html {
   min-height: 100vh;
 }
Run Code Online (Sandbox Code Playgroud)

您仍然会看到白色的条,但几秒钟后它将消失。此错误与浏览器渲染以及地址栏有关。

这是一篇Google帖子,解释了更多内容,并提出了解决该问题的其他方法:https : //developers.google.com/web/updates/2016/12/url-bar-resizing

  • 这是否意味着每次 URL 栏滚动到视图之外时(例如,当用户向下滚动页面时),“白条”都会继续弹出? (2认同)