【发布时间】:2018-11-17 18:26:58
【问题描述】:
我正在尝试使用 Angular 5。我对 Bootstrap 不太熟悉。
很少有组件在另一个内部。
如你所见,是我在这里声明的组件。
import { AppComponent } from './app.component';
import { NavBarComponent } from './nav-bar/nav-bar.component';
import { ChatWindowComponent } from './chat-window/chat-window.component';
import { TextSideComponent } from './chat-window/text-side/text-side.component';
chat-window.component.html 在这里
<div class="container-fluid bg-danger">
<div class="row">
<div class="col-4">
hi
<app-text-side></app-text-side>
</div>
<div class="col-8">
yes hope this works
</div>
</div>
</div>
但我想将这个红色组件扩展到屏幕底部。使该组件的大小为全窗口。
所以我将引导类.position-absolute .h-100 添加到ChatWindowComponent 的容器中。像这样。
<div class="container-fluid bg-danger position-absolute h-100">
<div class="row">
<div class="col-4">
hi
<app-text-side></app-text-side>
</div>
<div class="col-8">
yes hope this works
</div>
</div>
</div>
但是正如你所看到的,有一个滚动条。
它在下面进一步扩展,因此基本上忽略了 nav-bar.component 的高度,并从 ChatWindowComponent(容器)开始 100% 的窗口高度。
我尝试使用calc 函数计算高度但没有静脉。
有没有更好的方法呢?因为我总是无法计算 nav-bar.component 高度。它可能会有所不同。
有没有更好的方式从 CSS 的角度来理解 Angular?如何使其响应或假设下面(页脚)又出现了一个组件?那么如何再次调整 ChatWindowComponent 呢?
所有的硬编码 CSS 都是固定的吗?
关于如何在 Angular 中正确对齐所有内容的任何见解?
【问题讨论】:
-
您可以从任何样板开始,并且可以遵循它们的流程。 github.com/start-angular/SB-Admin-BS4-Angular-6github.com/ngx-rocket/starter-kit
标签: html css angular twitter-bootstrap angular5