<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Website</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f9;
color: #333;
}
header {
background-color: #4CAF50;
color: white;
padding: 20px;
text-align: center;
}
nav {
margin: 10px 0;
text-align: center;
}
nav a {
margin: 0 15px;
text-decoration: none;
color: #4CAF50;
font-weight: bold;
}
nav a:hover {
color: #333;
}
main {
padding: 20px;
text-align: center;
}
footer {
background-color: #eee;
padding: 10px;
text-align: center;
font-size: 0.9em;
}
button {
padding: 10px 20px;
margin-top: 20px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<header>
<h1>Welcome to My Website</h1>
</header>
<nav>
<a href="#about">About</a>
<a href="#contact">Contact</a>
<a href="#fun">Fun</a>
</nav>
<main>
<section id="about">
<h2>About This Site</h2>
<p>This is a simple example website created as a single HTML file. You can customize it however you like!</p>
</section>
<section id="contact">
<h2>Contact</h2>
<p>Email me at <a href="mailto:example@example.com">example@example.com</a></p>
</section>
<section id="fun">
<h2>Try This!</h2>
<button onclick="showMessage()">Click Me!</button>
<p id="message"></p>
</section>
</main>
<footer>
© 2026 My Website
</footer>
<script>
function showMessage() {
document.getElementById('message').textContent = "Hello! You clicked the button!";
}
</script>
</body>
</html>