How to use the grid-list in Angular Material, so that all page content is displayed between the header and footer?

别说谁变了你拦得住时间么 提交于 2020-01-25 09:53:05

问题


I use Angular 6 and Material 6.4.7. I need to implement the grid-list on the main page. Make it so that the header and footer have a fixed width, and content occupies the rest of the space. How do I do this?

<mat-grid-list cols="1">
<mat-grid-tile-header>
    <app-header></app-header>
</mat-grid-tile-header>
<mat-grid-tile>
    <router-outlet></router-outlet>
</mat-grid-tile>
<mat-grid-tile-footer>
    <app-footer></app-footer>
</mat-grid-tile-footer>


回答1:


MatGridList is not a layout tool! It is a component for displaying a list of tiles in a flexible grid format.

Based on your description, what you want to achieve is fairly easy with standard HTML and CSS flexbox. If you need more flexibility or a responsive layout, look into Angular Flex-Layout.



来源:https://stackoverflow.com/questions/52943177/how-to-use-the-grid-list-in-angular-material-so-that-all-page-content-is-displa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!