# Leaflet map not displaying correctly inside \<ion-content\>

**URL:** <https://forum.ionicframework.com/t/leaflet-map-not-displaying-correctly-inside-ion-content/185536>\
**Category:** Ionic Framework\
**Created:** [March 20, 2020, 7:15pm UTC](https://forum.ionicframework.com/t/leaflet-map-not-displaying-correctly-inside-ion-content/185536 "2020-03-20T19:15:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sweg](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Sweg](https://forum.ionicframework.com/u/Sweg)\
**Post date:** [March 20, 2020, 7:15pm UTC](https://forum.ionicframework.com/t/leaflet-map-not-displaying-correctly-inside-ion-content/185536/1 "2020-03-20T19:15:42Z")

</div>

I am having an issue displaying a Leaflet map in my ionic app.

Here is how it is displaying:

 ![map](https://global.discourse-cdn.com/ionicframework/original/3X/1/e/1e1234ce14d65af4db9a76ceb9069c67abd7ebf6.png)

And here is the HTML:

```auto
<ion-content>
  <div class="map-container">
    <div class="map-frame">
      <div id="map"></div>
    </div>
  </div>
</ion-content>

```

When I remove the `<ion-content>` tags, this is how it’s displayed:

Here’s the map.css:

```auto
.map-container {

    position: absolute;

    top: 0;

    left: 0;

    right: 0;

    bottom: 0;

    margin: 30px;

  }

  

  .map-frame {

    border: 2px solid black;

    height: 100%;

  }

  

  #map {

    height: 100%;

  }

```

 ![map1](https://global.discourse-cdn.com/ionicframework/original/3X/1/f/1fd054c558145fca05a50821ff5e8fc889721669.png)

As you can see in the second one, the full map is displayed, but it’s still not presenting correctly (i.e. overlapping the toolbar).

Can someone please tell me how this can be resolved?

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [March 20, 2020, 7:25pm UTC](https://forum.ionicframework.com/t/leaflet-map-not-displaying-correctly-inside-ion-content/185536/2 "2020-03-20T19:25:04Z")

</div>

how do your css Classes look like?

---

<div class="post-metadata">

**Author:** ![Sweg](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Sweg](https://forum.ionicframework.com/u/Sweg)\
**Post date:** [March 20, 2020, 7:26pm UTC](https://forum.ionicframework.com/t/leaflet-map-not-displaying-correctly-inside-ion-content/185536/3 "2020-03-20T19:26:23Z")

</div>

Added the map.css code above

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [March 20, 2020, 7:27pm UTC](https://forum.ionicframework.com/t/leaflet-map-not-displaying-correctly-inside-ion-content/185536/4 "2020-03-20T19:27:47Z")

</div>

If you inspect your Code which Div Class is the one that has the wrong small size?

---

<div class="post-metadata">

**Author:** ![fernandoghisi](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fernandoghisi/32/107443_2.png) [@fernandoghisi](https://forum.ionicframework.com/u/fernandoghisi)\
**Post date:** [November 16, 2023, 7:22pm UTC](https://forum.ionicframework.com/t/leaflet-map-not-displaying-correctly-inside-ion-content/185536/5 "2023-11-16T19:22:17Z")

</div>

For anyone having this kind of problem, just create the map inside “ **ionViewDidEnter** ” method (not in “ngAfterViewInit”, like I’ve found in many tutorials).
