【发布时间】:2018-03-25 04:10:35
【问题描述】:
我现在已经搜索和搜索了大约 3 个小时,因为我不想问,但是我怎样才能在底部保留一个 'footer' 变量而不是固定在底部,所以如果内容我的空间很小,它不会只停留在页面的中间,但是如果我有很多信息,它就不会锁定在页面的底部并在您滚动时坐在数据上方
我尝试了几种方法,包括: https://david-kerwick.github.io/2017/01/14/material-2-flex-layout-making-a-sticky-footer.html 大多数与此相关的问题我已经测试过,但都失败了,或者似乎根本不起作用。
这是我当前的代码:
<div class="content">
<app-navbar></app-navbar>
<app-footer></app-footer>
</div>
<app-content></app-content> 位于导航栏中,因为导航栏控制全页侧导航。
整个应用导航栏如下所示:
<mat-sidenav-container fullscreen>
<mat-sidenav mode="push" #sidenav>
<div fxLayout="column">
<mat-toolbar fxLayoutAlign="center center" color="primary">
<button mat-icon-button routerLink="/home" (click)="sidenav.close()">
<mat-icon>keyboard_backspace</mat-icon>
</button>
</mat-toolbar>
<button mat-button routerLink="/dashboard" (click)="sidenav.close()" >Information</button>
<button mat-button routerLink="/second" (click)="sidenav.close()" >Web tools</button>
</div>
</mat-sidenav>
<mat-toolbar color="primary" class="fixed-navbar mat-elevation-z10">
<button mat-icon-button (click)="sidenav.open()" fxHide="false" fxHide.gt-xs>
<mat-icon>menu</mat-icon>
</button>
<div fxLayout="row">
<button fxLayout="flex-shrink: 0;" mat-button class="title" style="font-size: 25px;">{{this.title}}</button>
<button fxShow="false" fxShow.gt-xs mat-button routerLink="/dashboard" [matMenuTriggerFor]="infoMenu">Information</button>
<button fxShow="false" fxShow.gt-xs mat-button routerLink="/second" [matMenuTriggerFor]="toolsMenu">Web tools</button>
</div>
<!-- fxFlex will fill the empty space and push the following items to the right -->
<div fxFlex></div>
<button mat-icon-button>
<mat-icon>face</mat-icon>
</button>
</mat-toolbar>
<app-container></app-container>
</mat-sidenav-container>
而页脚只是一个超级基本的组件,看起来像这样:
<mat-toolbar>
<div class="container">
<span>this is a toolbar</span>
</div>
</mat-toolbar>
到目前为止,只有我应用的样式是这样的:
@import url('https://fonts.googleapis.com/css?family=Comfortaa');
.title {
font-family: "Comfortaa";
}
html, body {
height: 100%;
margin: 0;
}
.content {
min-height: 100%;
}
在全局 style.css 文件中。
【问题讨论】:
-
值得注意的是,即使是带有 sidenav 示例的官方固定页眉/页脚也存在同样的问题。它可能只是不可行的 atm,我们可能不得不等待材料的更多更新
标签: angular flexbox material-design angular-material2