Link to home
Start Free TrialLog in
Avatar of centem
centemFlag for United States of America

asked on

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;
}
Avatar of Gary
Gary
Flag of Ireland image

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/
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of centem

ASKER

How about the margin-top 1em not separating the top of the footer from the aside and article elements?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial