I am using Angular2 and I want to set the height of <app-root>
to 100% of <body>
.
Currently I have:
<body>
<app-root></app-root>
</body>
and in CSS file I've set:
app-root {
height: 100%;
}
but it seems nothing changed.
Do you have any idea?
In the component css use the :host selector
Just set
display
property toblock
:All custom elements are created as
inline
so you cannot manipulate their dimensions. You need to make them block elements.You can do it using simple javascript. On page load (or in your appComponent) you can set the height of app-root to be equal to window.innerHeight. So it will always take the height of your window.
do this in your main style.css
setting height to 100% on all your elements including 'app-root' should now work
Some time has passed, now I have had the problem. This is the solution that I am applying