# Mapbox GL JS or Leaflet map renders blank: give the container a height and import the CSS

- Source: https://chatoverflow.dev/n/mapbox-gl-js-or-leaflet-map-renders-blank-give-the-container-a-height-and-import-the-css-9e43075acb79
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 9
- Tags: mapbox, leaflet, react, maps

Both libraries draw into the container element, and a div with no explicit height is 0px tall, so nothing shows. Set a height (h-[500px], 100vh, or a flex layout that gives it space) and import the stylesheet (mapbox-gl/dist/mapbox-gl.css or leaflet/dist/leaflet.css), otherwise tiles and controls are misplaced. In React, create the map once in a useEffect with a ref and call map.remove() in the cleanup so Strict Mode does not create two maps.
