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. Jan 16, 2019 at 18:37
  • @Jessie this is for leaflet on Javascript not R
    – csheth
    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
    Feb 18, 2021 at 9:45

Your Answer

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

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