Cosmic Explorer Homepage
I'll create a stunning space-themed homepage with twinkling stars, animated shooting stars, and interactive cosmic elements. Here's the complete solution:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cosmic Explorer | Journey Through the Universe</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background: linear-gradient(125deg, #000428, #004e92, #0f0c29, #302b63);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
color: #fff;
min-height: 100vh;
overflow-x: hidden;
position: relative;
}
/* Cosmic Background Elements */
.stars, .stars:after, .stars:before {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
pointer-events: none;
z-index: -1;
}
.stars:after, .stars:before {
content: "";
}
.stars {
background-image:
radial-gradient(2px 2px at 20px 30px, #fff, rgba(0,0,0,0)),
radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
radial-gradient(2px 2px at 50px 160px, #fff, rgba(0,0,0,0)),
radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0));
background-repeat: repeat;
background-size: 200px 200px;
}
.stars:after {
background-image:
radial-gradient(2px 2px at 150px 90px, #fff, rgba(0,0,0,0)),
radial-gradient(2px 2px at 120px 10px, #fff, rgba(0,0,0,0)),
radial-gradient(2px 2px at 180px 150px, #fff, rgba(0,0,0,0)),
radial-gradient(2px 2px at 30px 120px, #fff, rgba(0,0,0,0));
background-repeat: repeat;
background-size: 200px 200px;
opacity: 0.7;
}
.stars:before {
background-image:
radial-gradient(1px 1px at 50px 200px, #fff, rgba(0,0,0,0)),
radial-gradient(1px 1px at 10px 30px, #fff, rgba(0,0,0,0)),
radial-gradient(1px 1px at 190px 100px, #fff, rgba(0,0,0,0)),
radial-gradient(1px 1px at 80px 180px, #fff, rgba(0,0,0,0));
background-repeat: repeat;
background-size: 200px 200px;
opacity: 0.4;
}
/* Shooting Stars */
.shooting-star {
position: absolute;
height: 2px;
background: linear-gradient(-45deg, rgba(255,255,255,0.8), rgba(0,0,0,0));
border-radius: 999px;
filter: drop-shadow(0 0 6px rgba(255,255,255,0.5));
animation: tail 3000ms ease-in-out infinite,
shooting 3000ms ease-in-out infinite;
}
/* Container */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* Header & Navigation */
header {
padding: 20px 0;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.logo {
display: flex;
align-items: center;
gap: 12px;
font-size: 1.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 2px;
background: linear-gradient(45deg, #8a2be2, #00bfff, #ff00ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: gradient 3s ease infinite;
background-size: 300% 300%;
}
.logo i {
font-size: 2.2rem;
}
nav ul {
display: flex;
list-style: none;
gap: 30px;
}
nav a {
color: #fff;
text-decoration: none;
font-size: 1.1rem;
font-weight: 500;
letter-spacing: 1px;
position: relative;
padding: 5px 0;
transition: all 0.3s ease;
}
nav a:hover {
color: #8a2be2;
}
nav a:after {
content: '';
position: absolute;
width: 0;
height: 2px;
bottom: 0;
left: 0;
background: linear-gradient(90deg, #8a2be2, #00bfff);
transition: width 0.3s ease;
}
nav a:hover:after {
width: 100%;
}
/* Hero Section */
.hero {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 40px 0;
position: relative;
}
.hero h1 {
font-size: 4.5rem;
font-weight: 800;
margin-bottom: 20px;
letter-spacing: 3px;
text-transform: uppercase;
background: linear-gradient(45deg, #8a2be2, #00bfff, #ff00ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: gradient 3s ease infinite;
background-size: 300% 300%;
text-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
}
.hero p {
font-size: 1.4rem;
max-width: 700px;
margin-bottom: 40px;
line-height: 1.6;
color: #e0e0ff;
}
.cta-button {
display: inline-block;
padding: 16px 40px;
font-size: 1.2rem;
font-weight: 600;
text-decoration: none;
color: white;
background: linear-gradient(45deg, #8a2be2, #00bfff);
border-radius: 50px;
box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
z-index: 1;
}
.cta-button:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(45deg, #00bfff, #8a2be2);
z-index: -1;
opacity: 0;
transition: opacity 0.3s ease;
}
.cta-button:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 191, 255, 0.6);
}
.cta-button:hover:before {
opacity: 1;
}
/* Features Section */
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
padding: 80px 0;
}
.feature-card {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 30px;
text-align: center;
transition: all 0.3s ease;
border: 1px solid rgba(255, 255, 255, 0.1);
position: relative;
overflow: hidden;
}
.feature-card:hover {
transform: translateY(-10px);
box-shadow: 0 10px 30px rgba(138, 43, 226, 0.2);
border-color: rgba(138, 43, 226, 0.3);
}
.feature-icon {
font-size: 3.5rem;
margin-bottom: 20px;
color: #00bfff;
text-shadow: 0 0 15px rgba(0, 191, 255, 0.5);
}
.feature-card h3 {
font-size: 1.8rem;
margin-bottom: 15px;
color: #8a2be2;
}
.feature-card p {
color: #e0e0ff;
line-height: 1.6;
}
/* Footer */
footer {
text-align: center;
padding: 30px 0;
font-size: 1.1rem;
color: #a0a0ff;
border-top: 1px solid rgba(255, 255, 255, 0.1);
margin-top: auto;
}
.social-icons {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 20px;
}
.social-icons a {
display: inline-flex;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
color: #fff;
font-size: 1.5rem;
transition: all 0.3s ease;
}
.social-icons a:hover {
background: linear-gradient(45deg, #8a2be2, #00bfff);
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
}
/* Animations */
@keyframes gradientBG {
0% { background-position: 0% 50% }
50% { background-position: 100% 50% }
100% { background-position: 0% 50% }
}
@keyframes gradient {
0% { background-position: 0% 50% }
50% { background-position: 100% 50% }
100% { background-position: 0% 50% }
}
@keyframes shooting {
0% {
transform: translateX(0) translateY(0) rotate(-45deg);
opacity: 0;
}
10% {
opacity: 1;
}
100% {
transform: translateX(300px) translateY(300px) rotate(-45deg);
opacity: 0;
}
}
@keyframes tail {
0% {
width: 0;
}
30% {
width: 100px;
}
100% {
width: 0;
}
}
/* Planet Animation */
.planet {
position: absolute;
width: 200px;
height: 200px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #4a00e0, #8e2de2);
box-shadow: 0 0 50px rgba(142, 45, 226, 0.6);
top: 15%;
right: 10%;
z-index: -1;
animation: float 12s ease-in-out infinite;
}
.planet:after {
content: '';
position: absolute;
width: 30px;
height: 30px;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
top: 40px;
left: 50px;
}
.ring {
position: absolute;
width: 280px;
height: 10px;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotateX(75deg);
box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}
@keyframes float {
0% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(5deg); }
100% { transform: translateY(0) rotate(0deg); }
}
/* Responsive Design */
@media (max-width: 768px) {
.hero h1 {
font-size: 3rem;
}
.hero p {
font-size: 1.1rem;
}
nav ul {
gap: 15px;
margin-top: 20px;
}
.planet {
width: 120px;
height: 120px;
top: 10%;
right: 5%;
}
.ring {
width: 170px;
}
}
@media (max-width: 480px) {
.hero h1 {
font-size: 2.2rem;
}
.logo {
font-size: 1.4rem;
}
.feature-card {
padding: 20px;
}
}
</style>
</head>
<body>
<!-- Cosmic Background -->
<div class="stars"></div>
<!-- Planet Element -->
<div class="planet">
<div class="ring"></div>
</div>
<div class="container">
<!-- Header -->
<header>
<div class="logo">
<i class="fas fa-rocket"></i>
<span>Cosmic Explorer</span>
</div>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Explore</a></li>
<li><a href="#">Galaxies</a></li>
<li><a href="#">Planets</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<!-- Hero Section -->
<section class="hero">
<h1>Journey Through The Cosmos</h1>
<p>Embark on an interstellar adventure and discover the wonders of our universe. Experience the beauty of distant galaxies, nebulas, and cosmic phenomena.</p>
<a href="#" class="cta-button">Begin Exploration</a>
</section>
<!-- Features Section -->
<section class="features">
<div class="feature-card">
<div class="feature-icon">
<i class="fas fa-star"></i>
</div>
<h3>Stellar Navigation</h3>
<p>Navigate through constellations and star systems with our advanced cosmic mapping technology.</p>
</div>
<div class="feature-card">
<div class="feature-icon">
<i class="fas fa-satellite"></i>
</div>
<h3>Deep Space Probes</h3>
<p>Access real-time data from our network of deep space probes exploring distant galaxies.</p>
</div>
<div class="feature-card">
<div class="feature-icon">
<i class="fas fa-user-astronaut"></i>
</div>
<h3>Virtual Expeditions</h3>
<p>Join our virtual reality expeditions to experience space like never before.</p>
</div>
</section>
<!-- Footer -->
<footer>
<p>© 2023 Cosmic Explorer. Journey beyond the stars.</p>
<div class="social-icons">
<a href="#"><i class="fab fa-facebook-f"></i></a>
<a href="#"><i class="fab fa-twitter"></i></a>
<a href="#"><i class="fab fa-instagram"></i></a>
<a href="#"><i class="fab fa-github"></i></a>
<a href="#"><i class="fab fa-linkedin-in"></i></a>
</div>
</footer>
</div>
<script>
// Create shooting stars dynamically
function createShootingStars() {
const container = document.body;
const starCount = 8;
for (let i = 0; i < starCount; i++) {
const star = document.createElement('div');
star.classList.add('shooting-star');
// Random position
const posX = Math.random() * 100;
const posY = Math.random() * 100;
// Random delay and duration
const delay = Math.random() * 15;
const duration = 2 + Math.random() * 3;
star.style.left = `${posX}vw`;
star.style.top = `${posY}vh`;
star.style.animationDelay = `${delay}s`;
star.style.animationDuration = `${duration}s`;
container.appendChild(star);
}
}
// Initialize when page loads
window.addEventListener('load', () => {
createShootingStars();
// Add subtle animation to feature cards on scroll
const featureCards = document.querySelectorAll('.feature-card');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = 1;
entry.target.style.transform = 'translateY(0)';
}
});
}, { threshold: 0.1 });
featureCards.forEach(card => {
card.style.opacity = 0;
card.style.transform = 'translateY(30px)';
card.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
observer.observe(card);
});
});
</script>
</body>
</html>
Key Features of this Cosmic Homepage
-
Starry Background:
- Multiple layers of stars with varying sizes and opacities
- Realistic twinkling effect through CSS animations
-
Animated Shooting Stars:
- Randomly generated shooting stars that traverse the screen
- Customizable speed and trajectory
-
Floating Planet:
- Beautifully rendered planet with rings
- Subtle floating animation
-
Cosmic Color Scheme:
- Deep space gradients with blues, purples, and dark backgrounds
- Glowing effects for text and buttons
-
Interactive Elements:
- Hover effects on navigation links and buttons
- Animated call-to-action button with gradient transition
- Feature cards with hover animations
-
Responsive Design:
- Adapts to all screen sizes
- Mobile-friendly navigation
-
Modern Typography:
- Gradient text effects for headings
- Clean, readable body text
The design creates an immersive cosmic experience while maintaining excellent usability. You can simply copy and paste this code into an HTML file and run it directly in any modern browser.