Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 呈现内容前页脚出现问题_Css_Angular_Flexbox - Fatal编程技术网

Css 呈现内容前页脚出现问题

Css 呈现内容前页脚出现问题,css,angular,flexbox,Css,Angular,Flexbox,嗯,我尝试了很多可能的解决方案和方法(使用flexbox、position等)。在呈现容器组件之前,我不能将页脚组件放在底部。我有一个用于异步数据的微调加载程序,下面是页脚。所以把页脚和旋转器放在一起看真的很难看。我想把我的页脚一直放在底部(不是固定的),而不可见。我一直在阅读和测试->但没有解决方案 //app.component.html <app-header></app-header> <app-planet-data></app-planet-

嗯,我尝试了很多可能的解决方案和方法(使用flexbox、position等)。在呈现容器组件之前,我不能将页脚组件放在底部。我有一个用于异步数据的微调加载程序,下面是页脚。所以把页脚和旋转器放在一起看真的很难看。我想把我的页脚一直放在底部(不是固定的),而不可见。我一直在阅读和测试->但没有解决方案

//app.component.html

<app-header></app-header>
<app-planet-data></app-planet-data>
<app-footer></app-footer>
<nav class="navbar navbar-dark bg-dark">
    <h6 class="m-2 mx-auto text-muted">Footer</h6>
</nav>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
    <h3 class="m-2">The Red Planet Rovers</h3>
    <ul class="nav justify-content-end">
        <button pButton type="button" label="Image of the Day"></button>
        <button pButton type="button" label="Image Gallery"></button>
      </ul>
</nav>
<app-loading *ngIf="loading"></app-loading>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>

//footer.component.html

<app-header></app-header>
<app-planet-data></app-planet-data>
<app-footer></app-footer>
<nav class="navbar navbar-dark bg-dark">
    <h6 class="m-2 mx-auto text-muted">Footer</h6>
</nav>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
    <h3 class="m-2">The Red Planet Rovers</h3>
    <ul class="nav justify-content-end">
        <button pButton type="button" label="Image of the Day"></button>
        <button pButton type="button" label="Image Gallery"></button>
      </ul>
</nav>
<app-loading *ngIf="loading"></app-loading>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>

页脚
//header.component.html

<app-header></app-header>
<app-planet-data></app-planet-data>
<app-footer></app-footer>
<nav class="navbar navbar-dark bg-dark">
    <h6 class="m-2 mx-auto text-muted">Footer</h6>
</nav>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
    <h3 class="m-2">The Red Planet Rovers</h3>
    <ul class="nav justify-content-end">
        <button pButton type="button" label="Image of the Day"></button>
        <button pButton type="button" label="Image Gallery"></button>
      </ul>
</nav>
<app-loading *ngIf="loading"></app-loading>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>

红色星球漫游者
//planet-data.component.html

<app-header></app-header>
<app-planet-data></app-planet-data>
<app-footer></app-footer>
<nav class="navbar navbar-dark bg-dark">
    <h6 class="m-2 mx-auto text-muted">Footer</h6>
</nav>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
    <h3 class="m-2">The Red Planet Rovers</h3>
    <ul class="nav justify-content-end">
        <button pButton type="button" label="Image of the Day"></button>
        <button pButton type="button" label="Image Gallery"></button>
      </ul>
</nav>
<app-loading *ngIf="loading"></app-loading>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>
<app-planet-view [pics]="pics"></app-planet-view>

网页的主要内容位于页眉和页脚之间。在此主要元素上应用此css,您将完成以下操作:

#main-component {
    min-height: calc(100vh - 70px - 100px);
}
这里70是内容的高度+填充+页眉的边距。 100是内容的高度+填充+页脚的边距


只有在页眉和页脚大小固定的情况下,此解决方案才有效。

vh
中设置一些
min height
。谢谢,但即使我在页脚和页眉上设置了一些高度,它也不起作用。我不知道我是否遗漏了什么,因为我尝试了您的解决方案,甚至为两个组件(页眉和页脚)都设置了一些高度但它不起作用。@planet-data.component.html中的Nacho将所有标记包装在标记内,并在主标签上定义最小高度。