How to make Vue2-leaflet map have 100% height of its parent container?
When I set its style to style="height: 100%"
it is overwriting whole page on first interaction with the map and tile layer isn't showed at all.
Use calc(100% - 100px)
for #map-wrapper
because #some-div
has a height of 100px in your example.
Then the scrollbar disappears.
#some-div {
height: 100px;
}
#map-wrapper {
background-color: red;
height: calc(100% - 100px);
margin: 0;
}
Fiddle: https://jsfiddle.net/yLe9n1uk/
Or use a flexbox for the parent div (#app
):
#app {
display: flex;
flex-direction: column;
}
#some-div {
height: 100px;
}
#map-wrapper {
background-color: red;
height: 100%;
margin: 0;
}
Fiddle: https://jsfiddle.net/xo5z8r7q/
l-map
completely. You've setheight: 100%
onmap-wrapper
, so once that's added to the100px
ofsome-div
it overflows. For that example I'd just use flex-box instead but I'm not convinced that it's demonstrating the same problem you originally described in the question. – skirtle