2017-05-06 48 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%; 
}