Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sizing Leaflet Map inside bootstrap

I have been trying to change the height of my leaflet map to a percentage inside of bootstrap but everytime I do the map will not draw. Thus, I always have to revert to px value. I'm pretty sure its a simple setting that I'm missing since I am a CSS novice. Here is my css.

<style type="text/css">
  body {
    padding-top: 60px;
    padding-bottom: 40px;
  }
  #map {
    height: 75%;
    }
</style>
like image 304
njackson.gis Avatar asked Jun 02 '13 18:06

njackson.gis


3 Answers

Try adding a height property to body or parent container.

like image 195
Milo Wielondek Avatar answered Sep 26 '22 06:09

Milo Wielondek


CCS

#map
{
    width: 100px;
    height:100px;
    min-height: 100%;
    min-width: 100%;
    display: block;
}

html, body
{
    height: 100%;
}

.fill
{
    min-height: 100%;
    height: 100%;
    width: 100%;
    min-width: 100%;
}

html

<div class="container fill">
     <div id="map">

     </div> 
 </div>
like image 24
L. Sanna Avatar answered Sep 23 '22 06:09

L. Sanna


With CSS from project Bootleaf on Github:

html,body, #map{
    height:100%;
    width: 100%;
overflow: hidden;
}
body {
    padding-top: 50px;
like image 34
Tiago Fassoni Avatar answered Sep 24 '22 06:09

Tiago Fassoni