Simple Website Example

Project Structure
website/
├── index.html   # Main webpage
├── styles.css   # Styling
├── script.js    # Interactivity
└── Dockerfile   # Container configuration
Basic HTML Structure
<!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>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <header>
        <h1>Welcome to My Website</h1>
        <nav>
            <a href="#">Home</a>
            <a href="#">About</a>
            <a href="#">Contact</a>
        </nav>
    </header>
    <main>
        <h2>Hello World!</h2>
        <p>This is a simple website example.</p>
    </main>
    <script src="script.js"></script>
</body>
</html>
Simple CSS Styling
/* Basic styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

header {
    background-color: #333;
    color: white;
    padding: 1rem;
    text-align: center;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
}

nav a:hover {
    text-decoration: underline;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}
Basic JavaScript
// Wait for the page to load
document.addEventListener('DOMContentLoaded', function() {
    // Get the header element
    const header = document.querySelector('h1');
    
    // Add a simple click event
    header.addEventListener('click', function() {
        alert('Welcome to my website!');
    });

    // Change text color on hover
    header.addEventListener('mouseover', function() {
        this.style.color = '#007bff';
    });

    header.addEventListener('mouseout', function() {
        this.style.color = '';
    });
});
Code copied to clipboard!