1

I have been playing with CSS height property for a while, but I still can't find a solution.

This is my CSS:

html{
    height: 100%;
}
body{
    margin:0px; 
    padding:0px; 
    min-height:100%;
}
#container{
    position: relative;
    padding:40px;
    margin-top:2%;
    background-color:rgba(0, 0, 0, 0.7);
    margin-bottom:2%;
    height:auto;
}

Is there a way to fix this using CSS or may I use a javascript function?

2 Answers2

1

If what you are trying to accomplish is to create an overlay that extends to the bottom of the page, try changing the position property to fixed and set the height to 100%.

#container {
    position: fixed;
    height: 100%;
    /* other CSS properties */
}
dsan
  • 1,552
  • 12
  • 17
0

You can try setting height:100% to the body as well. Or you can use inherit feature,so it varies with the html height.

html
{
  min-height: 100%;
  height:100%;
}

body{
 margin:0px; 
 padding:0px;
 height:inherit;
} 

#container{
  background-color:rgba(0, 0, 0, 0.7);
  height:inherit;
  border:1px solid #333;
 }

Please check in fiddle: http://jsfiddle.net/rw99a/