<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Centered Image</title>
<style>
/* Reset margins and make sure the container takes up the full screen height */
html, body {
margin: 0;
padding: 0;
height: 100%;
background-color: #f0f0f0; /* Change this to change the background color */
}
/* The magic that handles the perfect centering */
.container {
display: flex;
justify-content: center; /* Centers horizontally */
align-items: center; /* Centers vertically */
height: 100%;
width: 100%;
}
/* Keeps the image responsive so it doesn't break on mobile screens */
.centered-picture {
max-width: 90%;
max-height: 90vh;
object-fit: contain;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Optional: adds a soft shadow */
border-radius: 8px; /* Optional: rounds the corners slightly */
}
</style>
</head>
<body>
<div class="container">
<!-- Replace the URL below with the link to your actual image -->
<img class="centered-picture" src="https://via.placeholder.com/600x400" alt="Centered Masterpiece">
</div>
</body>
</html>