Click here to Skip to main content
15,887,979 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

So I have a Bootstrap based website with some pretty dark background colours. The header (navbar) and footer are white. The content I set on a div with a class called BackLight:

CSS
.BackLight {
    background-color: #ffffff; /*! fallback */
    background-color: rgba(255, 255, 255, .7);
    box-shadow: 0px 0px 10px 0px #323232; /*! fallback */
    box-shadow: 0px 0px 10px 0px rgba(50, 50, 50, 0.75);
    min-height: 100% !important ;
    position: relative;
    z-index: 20;
    border-top-right-radius: 3px;
    border-top-left-radius: 3px;
}


This looks pretty good (thankfully! I'm no good at design :S)

The issue I have is that min-height: 100% !important ; does nothing.

I added the !important and still nothing. I took a look at the containers and it goes:
HTML
<html>
  <body>
    <form runat="server">
      <div class="col-sm-12 col-md-12 col-lg-8 BackLight">


I checked the form. Height was 0px. I don't think it matters but i set the height to 1000px and still no joy. Setting the min-height:1000px works, but I need the size to fit the page whatever the browser size :S

I checked the styles and couldn't find anything referring to height in any of the containers.

Any ideas where I am goin wrong?

Thanks ^_^
Andy
Posted

1 solution

The problem is that min-height:100% means 100% of the parent element's height. To take up the full height of the window, the form, body and html elements must also take up the full height of the window.

If you can drop support for IE8 and earlier[^], the simplest option is to use the new vh unit[^]:
CSS
min-height: 100vh;
 
Share this answer
 
Comments
Andy Lanng 7-Jul-15 12:25pm    
my hero ^_^

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900