$(function() {
var headerHeight = $("#header").height();
var footerHeight = $("#navfooter").height();
var windowHeight = $("html").height();
var remainHeight = windowHeight-headerHeight-footerHeight;
$("#mapid").css({"height":remainHeight});
var mymap = L.map('mapid').setView([30.8864928,-5.4257845 ], 5);
L.tileLayer('https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.jpg?access_token=pk.eyJ1IjoiemFraWdhdGVzIiwiYSI6ImNrZmNkNXJ1djFlaGsydHBwYzRjOXBqbHIifQ.nFOZC7iLO3gaGkhiFajGAQ', {
attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.',
maxZoom: 18,
tileSize: 512,
zoomOffset: -1
}).addTo(mymap);
var maroc = data
var region = new L.GeoJSON(maroc)
region.addTo(mymap)
});
html, body {
width: 100%;
height: 100%;
}
#titreCarte {
font-family: 'Raleway', sans-serif;
}
#footer {
font-family: 'Raleway', sans-serif;
}
.category{
height: 65%;
width: 7%;
z-index: 999;
position: absolute;
flex: 1;
background-color: white;
left :1%;
top: 18%;
border-radius: 10px ;
opacity: 0.5;
}
.category_img {
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
position: absolute;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@300;400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="crossorigin=""/>
<link rel="stylesheet" href="index.css">
<title>La carte interactive | GIZ</title>
</head>
<body>
<nav class="navbar navbar-light bg-light" id="header">
<a class="navbar-brand" href="#">
<img src="logo_ministere_en1.png" width="50" height="40" class="d-inline-block align-top" alt="" loading="lazy">
<img src="logo_ministere_enText.png" width="100" height="40" class="d-inline-block align-top" alt="" loading="lazy">
<span id="titreCarte"> | Carte de diversité biologique du Maroc</span>
</a>
</nav>
<div id="mapid">
<div class="category">
<div class="col-12 category_img">
<img src="sibe_marker.png" alt="" width="100" height="100">
<p class="text_category"></p>
</div>
<div class="col-12"></div>
<div class="col-12"></div>
<div class="col-12"></div>
</div>
</div>
<nav id="navfooter" class="navbar fixed-bottom navbar-light bg-light" style="display: flex; justify-content: center; align-items: center;">
<a id="footer" class="navbar-brand" href="#">2020 © Tous droits réservés</a>
</nav>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="index.js"></script>
<script src="data.js"></script>
</body>
</html>
I have a map displayed on the background using a leaflet. I have a div positioned on top of the map. inside the div, I have another div that contains an image and text.
my problem is the category_img div is not positioned on top of the category one.
I added a code snipet to see how it behaves. Your help is appreciated