我想将我的div与我的页面中心的一些登录信息对齐。它适用于静态值,但我想动态定位它。另外,背景应该覆盖整个页面,但它只是涵盖了与我的div的高度带...如何在整页面背景的页面中心放置Div
这里是我的代码:
.bold{
\t font-weight: bold
}
#login {
\t width: 300px;
\t margin-left: auto;
margin-right: auto;
margin-top: 15%;
background-color: white;
border-style: outset; <!--Just there to show the border-->
}
.background {
\t background-color: #f5f5f0;
\t min-height: 100%;
\t height: auto !important;
}
<div class=background> \t
\t <div class="well well-lg" id="login">
\t \t <h2>LOGIN</h2>
\t \t <form method="post" ng-submit="login()">
\t \t \t <input name="username" type="text" ng-model="username" placeholder="username"><br>
\t \t \t <input name="password" type="password" ng-model="password" placeholder="password"><br>
\t \t \t <input type="submit" value="Einloggen">
\t \t </form>
\t </div>
</div>
https://css-tricks.com/centering-css-complete-guide/,https://css-tricks.com/centering-in-the-unknown/ – CBroe