I tried to replicate the react-resizable-panels example component usage by copying over the code to Codesandbox. But in the codesandbox, the content doesn’t take up the whole viewport height. There’s absolutely no difference in styles as far as I can tell. The body
height is 100%. It seems to expand it to full-height only in the react-resizable-panels
example.
Here are the two identical code examples for reference:
- Original extracted: https://react-resizable-panels.surge.sh
- Codesandbox clone: https://y6yhjv.csb.app
Any help with debugging the difference between the two examples would be highly appreciated.
Thanks. 🙂
2
Answers
height: 100%
requires a parent element to reference for height. I’m actually more surprised that the first example goes to full height.Either way, adding
height: 100vh;
to your<div id="root">
element (ie. parent element) will give you full height. Optionally, you could add it to the element that’s currently set toheight: 100%
.It looks like the missing <!Doctype html> makes
react-resizable-panels
example revert back to ‘quirks’ mode and causehtml
andbody
take up 100% of the page height. Just tested with a quick code and below is the result.See thoroughly for the structure in both and their respective computed height.