Reputation: 771
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:
How can I center the icon?
Upvotes: 3
Views: 3060
Reputation: 26
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;
}
Upvotes: 1