I'm struggling to create a perfectly centered website layout.
Let me share my CSS code with you:
body {
background-image: url('background.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
.centered{ /* Center the whole body */
width: 800px;
margin: 0 auto;
}
Now, let's take a look at my HTML markup:
<!DOCTYPE html>
<html>
<head>
<title>Training File Upload</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="centered">
<h1>MusicAI</h1>
<form method="POST" >
<span>Choose midi files:</span>
<input type="file" name="file[]" multiple required/>
<br>
<input type="submit" name="submit" value="Upload for training" />
</form>
</div>
</body>
</html>
Currently, all elements on my site appear in the top right corner. I suspect that my "centered" class isn't functioning correctly, as there is no visible change after refreshing the page.
If you have any suggestions or insights, please share them! Your assistance would be greatly appreciated.