I can't add the attribution control for the life of me. This is my 4th time using Leaflet in a webapp and the first time I have this issue.

var map = L.map('map').setView([55.861098, -4.255484], 14);
var OpenStreetMap = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  maxZoom: 19,
  minZoom: 12,
  zoomControl: true,
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',

I mean it's all very standard stuff, literally copy/paste from the documentation.

Is it possible that I am missing some Leaflet JS/CSS files or am I overriding it with some of my custom CSS?

  • Attribution is OK and should work. Check in browser debugger if control HTML element is present and what are control's CSS.
    – TomazicM
    Dec 14 '21 at 21:24
  • I'm pretty sure taht you overwrite some css styles. Check the z-index of the attribution container Dec 15 '21 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.