HTML, CSS, Dar Background. One Single Page, Coming Soon, Count Down set for July, 28, 2024
Sure! Below is a simple HTML and CSS code for a "Coming Soon" page with a dark background and a countdown timer set for July 28, 2024.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coming Soon</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Coming Soon</h1>
<p id="countdown"></p>
</div>
<script>
// Set the date we're counting down to
var countDownDate = new Date("July 28, 2024 00:00:00").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Display the result in the element with id="countdown"
document.getElementById("countdown").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("countdown").innerHTML = "EXPIRED";
}
}, 1000);
</script>
</body>
</html>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #121212;
color: #ffffff;
font-family: Arial, sans-serif;
}
.container {
text-align: center;
}
h1 {
font-size: 3em;
margin-bottom: 20px;
}
#countdown {
font-size: 2em;
}
HTML Structure:
div
with a class of container
that contains an h1
element for the "Coming Soon" text and a p
element with an id of countdown
for the countdown timer.CSS Styling:
#121212
), centers the content both vertically and horizontally, and sets the text color to white.container
class centers the text.h1
and #countdown
elements are styled to have larger font sizes for better visibility.JavaScript Countdown:
You can save the HTML and CSS code in their respective files (index.html
and styles.css
) and open the index.html
file in a web browser to see the "Coming Soon" page with