1

Thank you for offering your help here. I have built a MapBox application. I wanted to add a copyright prior to MapBox's copyright logo. I used the L.control.attribution as:

varName = L.control.attribution({prefix: 'some text'}).addTo(map);

I used FireFox inspector and found that some text is a child of -> a div class="leaflet-control-attribution leaflet-control" from leaflet.css.

I have my own custom.css file and I tried to use it to override the class leaflet-control-attribution in leaflet.css but it is not working. Is this something from MapBox.css to prevents overriding or from leaflet? Is there a solution to fix this? I just wanted to change the background of the parent div of the L.control.attribution DOM object.

Thanks in advance.

Ahmad

Alexandr Lazarev
  • 12,554
  • 4
  • 38
  • 47
Ahmad Aburizaiza
  • 31
  • 1
  • 1
  • 2

3 Answers3

4

You can do it by this way

var leafletMap = L.map('map').setView([23.709921, 90.407143], 7);

 leafletMap.attributionControl.addAttribution('Licensed by &copy; <a href="some_link", class="your_class">Habijabi</a>');
pd farhad
  • 6,352
  • 2
  • 28
  • 47
0

You can pass an html text in place of "sometext".

varName = L.control.attribution({prefix: '<span class="AttributionClass">some text</span>'}).addTo(map);
Rahul
  • 1
-1

leaflet-control-attribution is probably getting over-ridden. try adding '!important' to the css attribute.

MK4
  • 725
  • 8
  • 24