How can I make the background of the Leaflet map transparent. I see opacity controls from the layers, but not the map background. Should the be changed just with plain CSS?

3 Answers 3


Hey plain CSS did the trick:

.leaflet-container {

This worked for me,

.leaflet-container {
  background: none !important;

Try using the leaflet.extras package -- you can make the background white or transparent!



setMapWidgetStyle(list(background= "white"))
  • This question is about Javascript Leaflet. Commented Jan 16, 2019 at 18:37
  • @Jessie this is for leaflet on Javascript not R
    – csheth
    Commented Apr 9, 2020 at 7:24
  • I found this very useful, because I couldn't find an appropriate answer for R. Came up on google, problem solved. Thank you.
    – Stephan
    Commented Feb 18, 2021 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.