JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Leaflet Map with Buttons</title>
<!-- Leaflet CSS and JS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" />
<style>
#map {
height: 400px;
position: relative;
}
.extendable-button-container-left {
position: absolute;
top: 20px; /* Adjust top position */
left: 20px;
z-index: 1000;
}
.extendable-button-container-right {
position: absolute;
top: 20px; /* Adjust top position */
right: 20px;
z-index: 1000;
}
.extendable-button-left {
background-color: #0d6efd;
color: white;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
margin-bottom: 10px;
box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5); /* Add shadow effect */
}
.extendable-button-left i {
color: white; /* Change icon color to white */
transition: all 0.3s ease;
}
.extendable-button-left:hover,
.extendable-button-left:focus {
background-color: #0d6efd;
}
.extendable-button-left:active {
background-color: #0daafd;
}
.hint-left {
display: none;
font-size: 14px;
color: white; /* Change hint text color to white */
margin-left: 10px;
transition: all 0.3s ease;
text-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5);
}
.extendable-button-left:hover .hint-left,
.extendable-button-left:focus .hint-left {
display: block;
}
.extendable-button-left:hover i,
.extendable-button-left:focus i {
...