Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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%; in the component's css file. I'm attempting to layer them and want each component to take up the whole screen height, but height:100% has no effect.

For reference I'm attempting to emulate something like http://andrewborstein.github.io/portfolio/

like image 372
Jeff Avatar asked Dec 02 '22 10:12

Jeff


2 Answers

use :host selector

hello.component.css

:host{
    background: #4285f4;
    color:#fff;
    position: fixed;
    top:0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100  
}

stackblitz example

like image 134
Muhammed Albarmavi Avatar answered Dec 03 '22 23:12

Muhammed Albarmavi


Just add style to your element:

height: 100vh;

Or create a css class and add it to element:

.full-height {
    height: 100vh;
}
like image 40
Denis.E Avatar answered Dec 03 '22 22:12

Denis.E