Search code examples
htmlcssfooter

How to fit height of aside to body height


  1. i need to fit the height of aside to that of body without regard to how much content there is. As it is it gives me fig. 2 and i need to have figure 1.

  2. I also need to have footer fit inside of body height. position:absolute does fit but overrides margin:auto which centers the body element. How do i align div elements
    Html code:

    <html> <body>
    <header></header>
    <aside></aside>
    <footer></footer>
    </body> </html>

My css code is this:

  body{ width:920px;
    position:absolute;
    height:auto; }
aside { float:left;
    width:170px; }

 footer { float: right;
     background: #E7DBD3;
     clear:both; }

Body and aside heights


Solution

  • You should be able to set the top and bottom values of the aside. Something like:

    aside { 
      position: relative;
      float:left;
      width:170px; 
      top: 0px;
      bottom: 0px;
    }