I've been working on a page layout where I have a menu with images aligned in a ul. However, when I try to add text under each image, the text ends up misaligned all the way to the right of the menu. I'm considering starting from scratch without using JavaScript and just implementing the images directly in the HTML file. After spending 10 hours straight on designing my website and learning new things, I might be too tired to figure this out. Any assistance would be greatly appreciated.
Here is the HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Map Gallery</title>
<link rel="stylesheet" href="stylemaps.css">
</head>
<body onload="document.body.style.opacity='1'">
<header>
<h1>Map Gallery</h1>
</header>
<div class="menu">
<ul id="imageList"></ul>
</div>
<div class="mappages">
<a href="#" id="chapter1">Chapter 1</a>
<a href="#" id="chapter2">Chapter 2</a>
<a href="#" id="chapter3">Chapter 3</a>
<a href="#" id="chapter4">Chapter 4</a>
</div>
<script src="fadeAnim.js"></script>
<script src="mapscript.js"></script>
</body>
</html>
CSS styles:
@charset "utf-8";
/* CSS Document */
body {
background-image: url("../images/background-maps.jpg");
background-repeat: no-repeat;
background-size: cover;
padding:0;
margin:0;
opacity: 0;
transition: opacity 1s;
}
.menu{
background-color: rgba(255,255,255,0.5);
justify-content: center;
display: flex;
align-items: center;
margin: 0 auto;
width:55%;
height: 100%;
}
.menu ul{
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.menu li{
width: 20%;
min-width: 200px;
margin: 10px;
text-align: center;
}
.menu img{
width: 100%;
height: 100%;
object-fit: cover;
}
h1{
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
font-weight: 600;
font-size: 75px;
text-align: center;
text-shadow: 1px 1px 2px red, 0 0 0.5em blue, 0 0 0.1em blue;
margin: auto;
}
JavaScript:
// JavaScript code here