3

I'm using Leaflet easy button on my Leaflet map:

<!-- Load LeafletEasyButton -->  
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js"></script>

I'm also using Google Material icons:

<!-- Load Google Material Icons -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

The goal is to create a custom button on my leaflet map like this:

L.easyButton('<i class="material-icons" style="font-size:18px;">gps_fixed</i>', function(){
    locateMe();
}, {position: 'bottomright'}).addTo(map);

It works, but icon in my custom button is positioned above button center:

enter image description here

How can I center the icon?

Marin Leontenko
  • 711
  • 2
  • 20
  • 26

1 Answers1

1

you can use left/top in css code:

 .widget-code {
    display: block;
    height: 18px;
    left: 6px;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 6px;
    width: 18px;
}
kboul
  • 13,836
  • 5
  • 42
  • 53