[英]How to get Angular component to take full height of screen
I'm nesting an angular component inside another one that is taking up the whole screen using height:100%;
我将一个角度组件嵌套在另一个使用
height:100%;
占据整个屏幕的组件中height:100%;
in the component's css file.在组件的 css 文件中。 I'm attempting to layer them and want each component to take up the whole screen height, but
height:100%
has no effect.我试图将它们分层并希望每个组件占据整个屏幕的高度,但
height:100%
没有效果。
For reference I'm attempting to emulate something like http://andrewborstein.github.io/portfolio/作为参考,我试图模仿http://andrewborstein.github.io/portfolio/ 之类的东西
use :host
selector使用
:host
选择器
hello.component.css hello.component.css
:host{
background: #4285f4;
color:#fff;
position: fixed;
top:0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 100
}
Just add style to your element:只需为您的元素添加样式:
height: 100vh;
Or create a css class and add it to element:或者创建一个 css 类并将其添加到元素:
.full-height {
height: 100vh;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.