7

I've tried looking up this topic on here, none of the answers answered my specific problem.

The problem is this: Every time I go to the mobile version of my site, I scroll down the first time to the very bottom of my page and it's fine, my background image fills the entire screen. But then I scroll back up and scroll back down and there's suddenly a white bar below my footer. I've tried numerous things in CSS and HTML and nothing has worked so far.

Again, this problem does not happen in my desktop version and only happens on the mobile version the 2nd time I scroll down.

This is my current code for CSS and 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;
}
<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>

Here are pictures of my problem:

With no whitespace:

No White Space

With whitespace:

White Space

Any help much appreciated. Thanks!

Rescis
  • 547
  • 5
  • 19
mfierro31
  • 75
  • 1
  • 6
  • I tested this on code pen, Looks absolutely fine there, share a link for this where you hosting it – Imran Rafique Nov 19 '17 at 01:16
  • 1
    Looks related to the address bar. in the first pic the address bar is visible; in the 2nd it isn't, and the white space at the bottom looks to be the same height as the missing bar. – wazz Nov 19 '17 at 01:24
  • @Comunit3, this is my web address right now - http://213.167.240.251/ – mfierro31 Nov 19 '17 at 01:28
  • @wazz Ahhh, you're right...in that case... how do I fix that? How would I even google that? Like, how do you get rid of address bar space on bottom of website? – mfierro31 Nov 19 '17 at 01:30
  • not sure. i can't even test mobile right now. maybe start by staying with the first 'state' (with the address bar) and somehow get rid of the address bar without scrolling to see what effect it has when you get rid of it. you might need a kind of 'push div'. (look up 'push div'. it's used for fixed footers sometimes, or used to be.) – wazz Nov 19 '17 at 01:39

1 Answers1

9

Apparently this is an old Chrome and Android bug. There are several ways to try to "avoid" the bug. The simplest is to add the following code at the beginning of your CSS:

  html {
   min-height: 100vh;
 }

You will still see the white bar, but it will disappear a few seconds later. This bug is related to browser rendering along with the address bar.

Here is a Google post explaining a little more and speaking some other ways to get around the problem: https://developers.google.com/web/updates/2016/12/url-bar-resizing

Ian Welerson
  • 410
  • 3
  • 8
  • 2
    Does this mean the "white bar" will continue to pop up each time the URL bar is scrolled out of view, for example, when the user is scrolling down the page? – Sikander Jun 20 '18 at 21:11