By default, when leafletJS is loading a map, the background tiles are all grey. I'd like to change that color to be black (or any other arbitrary color). How can I go about doing this?
Asked
Active
Viewed 1.3k times
1 Answers
40
It's controlled by the below css rule in the file 'leaflet.css':
.leaflet-container {
background: #ddd;
}
so you just need to change this rule.

dencey
- 1,041
- 17
- 25
-
1This isn't working for me, mid 2019. The property is set, and overwriting the underlying property, but the map still flashes the default grey when loading. – Synesso Jul 13 '19 at 06:41
-
2Make sure to load your style sheet after the leaflet style sheet or append the rule with !important – user611478 Sep 18 '19 at 17:14
-
This can also be done with `!important` without worrying about its ordering with respect to the leaflet style sheet. – a2f0 Sep 11 '21 at 05:03