Hello, I am developing a desktop application using electron. The app just, for now, displays a map created with openlayers 3. Trying to make the map fill the full height of the window with the property css height : 100%;
seems to "do not listen".
I have verified that the height of the map varies only when the width varies, no matter what height you set, as if it were proportional to the width of the map.
mainWindow {width : 800, height : 600}
mainWindow {width : 600, height : 600}
Looking at the dev tools
, it seems that the style is applied but it does not respect the height, why?
If I understand your question, what you want is to adapt the map depending on the height and width of the screen, that is, make it responsive.
This is all because you may not be setting a height:100% to the parent element where you have your map, which in this case would be the html and body tag. I leave you an example that I have already put here a few times, I hope it will help you.
If you notice, it adapts to the size of the screen. I hope it helps you and if you have any questions, I will gladly read it to help you! Greetings.
Actually the problem is when sizing the windows in Electron
BrowserWindow
: for them to be sized to the full size of the window just import the screen module from electron or runelectron.screen
something like this; the methodgetPrimaryDisplay
returns a lot of data, you must choose the one that best suits your needs. You can check more in the API documentation .You can use
100vh
instead of100%
and that's it.Measurements
vh
refer to the size of the screen and not the size of the element's parent .