Hello, I am currently facing an issue while trying to insert a Leaflet JS map into a placeholder div. The problem I am encountering is that the map seems to be overflowing out of the designated center square area. Can anyone explain why this might be happening?
html, body {
height: 100%;
}
.outer {
border: 1px solid black;
height: 100%;
width: 50%;
}
.map_panel {
margin-left: 25%;
margin-top: 25%;
border: 1px solid black;
height: 40%;
width: 40%;
}
<head>
<meta charset="UTF-8">
<title>mapform</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="outer">
<div class="map_panel">
<div id="embed_map"></div>
</div>
</div>
<script>
//Creating map options
var mapOptions = {
center: [35.7101, 139.8107],
zoom: 15
}
//Creating a map object
var map = new L.map('embed_map', mapOptions);
L.marker(mapOptions.center).addTo(map);
//Creating a Layer object
var layer = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
//Adding layer to the map
map.addLayer(layer);
</script>
</body>
</html>