Certainly! Below is a simple yet cool homepage design with a starry background and some CSS effects. You can copy and paste this code into your HTML and CSS files to get started.
HTML (index.html):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cool Homepage</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="stars"></div>
<div class="content">
<h1>Welcome to My Cool Homepage</h1>
<p>Explore the universe of possibilities!</p>
<button class="glow-button">Get Started</button>
</div>
</body>
</html>
CSS (styles.css):
/* General Styles */
body, html {
margin: 0;
padding: 0;
height: 100%;
font-family: 'Arial', sans-serif;
overflow: hidden;
background: #000;
color: #fff;
}
/* Starry Background */
.stars {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #000 url('https://www.script-tutorials.com/demos/360/images/stars.png') repeat top center;
z-index: -1;
}
/* Twinkling Stars Effect */
.stars::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent url('https://www.script-tutorials.com/demos/360/images/twinkling.png') repeat top center;
animation: twinkle 10s linear infinite;
}
@keyframes twinkle {
0% { background-position: 0 0; }
100% { background-position: -1000px 500px; }
}
/* Content Styling */
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
z-index: 1;
}
h1 {
font-size: 3em;
margin-bottom: 20px;
text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073;
}
p {
font-size: 1.2em;
margin-bottom: 30px;
}
/* Glow Button */
.glow-button {
padding: 15px 30px;
font-size: 1.2em;
color: #fff;
background-color: #6200ea;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s, box-shadow 0.3s;
box-shadow: 0 0 10px #6200ea, 0 0 20px #6200ea, 0 0 30px #6200ea;
}
.glow-button:hover {
background-color: #3700b3;
box-shadow: 0 0 20px #3700b3, 0 0 40px #3700b3, 0 0 60px #3700b3;
}
Explanation:
- Starry Background: The
.stars class creates a starry background using a repeating star pattern. The ::after pseudo-element adds a twinkling effect with another layer of stars that move slowly.
- Content Styling: The
.content class centers the text and button on the page. The heading has a neon text effect using text-shadow.
- Glow Button: The button has a glowing effect with a smooth transition on hover.
Notes:
- Replace the star and twinkling images with your own if needed. The URLs provided are placeholders.
- This design works best in fullscreen mode due to the
overflow: hidden property.
Let me know if you'd like to add more features or customize it further! 🚀✨