2017-05-06 45 views
1

Materializecss中心我使用的materializecss框架:http://materializecss.com
我想有容器的中间内登录表单: enter image description here 我已经尝试设置div容器到100%,但是,它使100% +导航栏,所以它会添加一个滚动条。这是我的HTML我怎么会有现在:内部容器

<div class="container"> 
<router-outlet></router-outlet> 
<app-login> 
<div class="valign-wrapper full-height"> 
     <div class="center-block"> 
      <form novalidate="" class="ng-untouched ng-pristine ng-valid"> 
       <div class="input-field"> 
        <i class="material-icons prefix">perm_identity</i> 
        <input id="username" type="text"> 
        <label for="username" class="">Gebruikersnaam</label> 
       </div> 
       <div class="input-field"> 
        <i class="material-icons prefix">lock</i> 
        <input id="password" type="password"> 
        <label for="password">Wachtwoord</label> 
       </div> 
       <div class="valign-wrapper"> 
        <button class="btn waves-effect waves-light center-block" name="login" type="submit"> 
         Inloggen 
        </button> 
       </div> 
      </form> 
     </div> 
    </div> 
</app-login> 
</div> 

我也看到一些计算器的答案,但那些不真正使responive,其中大部分是position: absolute,我不想因为我希望它在容器内。

+0

所以,如果我做的容器'位置:relative'然后孩子的div绝对会在容器内居中? –

+0

我刚试过,但问题是我的容器没有完整的高度。 –

+0

你可以设置容器div为100% - 导航栏的大小?另外如果可能的话,在codepen或jsfiddle上进行演示。 – Niraj

回答

0

给该div一个ID。

然后,在style.css中添加:

#id { 
    width: 100%; 
    height: 100%; 
}