【发布时间】:2019-11-16 16:11:48
【问题描述】:
我正在尝试使用 angular-material 8 创建一个网页。这个想法是页眉和页脚都应该是粘性的,内容应该填满页面的其余部分。 A,对我来说,标准的应用程序页面。
尽管谷歌搜索我没有成功。建议、版本等太多,没有人适合我,所以在这里寻求帮助。
首先,这是我的 index.html 和相应的 style.css
<!DOCTYPE html>
<html>
<head>
<base href="/" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>Angular 7 User Registration and Login Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body class="body">
<app>Loading...</app>
</body>
</html>
---------------------------
.body {
background: black;
}
然后我就有了应用程序组件。
--------------------------
<div class="page">
<app-navigation class="header" ></app-navigation>
<router-outlet class="content"></router-outlet>
<app-footer class="footer" ></app-footer>
</div>
---------------------------
.page {
margin: 0px;
display: flex;
flex-direction: column;
min-height: 100vh;
background: yellow;
}
.content {
width: 100%;
background:salmon;
}
.footer, header{
flex: none;
width: 100%;
margin: auto auto 0 auto;
background:gray;
}
-----------------------------
请注意滚动条。似乎页眉、内容和页脚大于浏览器中的可用区域。 怎么来的??
另外,请注意黑色区域。黑色来自“身体”类。怎么看得出来??不应该被“page”类覆盖吗?
我真的非常希望能得到一些帮助。
【问题讨论】:
-
您能否将您的应用程序添加到stackblitz.com,这样会更容易解决您的问题
标签: angular-material