简体   繁体   中英

div doesn't take the whole height / is not 100%

here is the live link: http://mrgsp.md:8080/a/Account/SignIn

the main div (green one) doesn't take 100% of the screen height

you will notice this only if you have a big screen 替代文字

and the code is basically

<body>
<div class="loginpage">
<div id="loginbox">stuff inside loginbox</div>
</div>
</body>

.loginpage {
background:none repeat scroll 0 0 green;
padding:200px;
}

Sorry for my english...

put the background style in body... is better.

body{
  background: green;
}

if you still want to put a height for the div, you must to put 100% height for div, for body and for html too.

html, body, .loginpage{
  height: 100% ;
}

你可以给身体绿色背景颜色?

You can't simply set a div height to 100%, because it will interpret that as 100% of its container .

The simplest solution to your problem is to set the background color on the body element, but alternatively, you can use your method by setting the body tag to have a height of 100%. This will give your div something to fill fully. If the body or whatever container of the div doesn't have a height set, then the browser defaults the css property of the div to height: auto.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM