footer not at bottom of page

How do I make the footer stay at bottom and why does the code at least show the 1em margin-top for the footer in order to separate it from the aside and article elements? Thank you.

<!DOCTYPE HTML>
<HTML>
      <HEAD>
            <link rel="stylesheet" type="text/css" href="stylesheet.css" />
      </HEAD>
      
      <BODY>

      
      <header>header</header>
      
      <aside>aside</aside>
      
      <article>article</article>
      
      <footer>footer</footer>

            
      </BODY>
</HTML>

//////////////////////////////////////////////////////////////////////////////////////////////////

html{
      height: 100vh;
}

body{
      border: 2px solid black;
      height: 100%;
}

header {
      width: 100%;
      height: 100px;
      background-color: gray;
      margin-bottom: 1em;
}

aside{
      width: 250px;
      height: 300px;
      background-color: blue;
      float: left;
}

article{
      width: 250px;
      height: 300px;
      background-color: red;
      float: right;
}

footer{
      width: 100%;
      height: 100px;
      background-color: gray;
      clear: both;
      bottom: 0;
      margin-top: 1em;
}
centemAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Is it supposed to stick to the bottom regardless or only when there is not enough content to push it down?
Like here
http://www.cssstickyfooter.com/
0
COBOLdinosaurCommented:
bottom 0; is not going to work without content.

If you want it at the bottom content then you need to use position:absolute and if you want it at the bottom of the screen all the time then you want it to be position:fixed with a z-in dex of 10 or more.

height 100% for the body is interpreted differently by different browsers/versions.  I you do not have enough content to fill the screen then there is no guarantee that will work.

Cd&
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
centemAuthor Commented:
How about the margin-top 1em not separating the top of the footer from the aside and article elements?
0
GaryCommented:
Change your aside to display: inline-block; and not floated
Or add the margin to the aside or article.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.