Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React - Component Full Screen (with height 100%)

Tags:

html

css

reactjs

I'm stuck with displaying a React component named "home" that take 100% of the height of my screen. Whatever I use CSS or React inline style it doesn't work.

In the example below, html, body and #app are set to height: 100% in CSS. For .home I used inline style (but whatever I used CSS or inline style is the same): enter image description here The issue seems to come from <div data-reactroot data-reactid='1'> that is not set with height: 100%.

If I hacked it with Chrome developer tool, it's work: enter image description here

So what is the proper way to display a full height component in React ?

Any help is welcome :)

like image 745
Thibault Clement Avatar asked Jul 18 '16 03:07

Thibault Clement


People also ask

How do you make a div full height in React?

To set a Div's height to cover the full screen in React, set its height to 100vh , e.g. <div style={{height: '100vh'}}>... </div> . When the height of the element is set to 100vh , it covers 100% of the viewport's height.


1 Answers

html, body, #app, #app>div {   height: 100% } 

This will ensure all the chain to be height: 100%

like image 168
bora89 Avatar answered Sep 17 '22 15:09

bora89