Basic HTML Layout with Navigation and Logo
HTML Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Basic Layout with Navigation</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!-- Header Section with Logo and Navigation -->
<header class="header">
<div class="logo">
<img src="logo.png" alt="Logo">
<h1>My Website</h1>
</div>
<nav class="navbar">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<!-- Main Content Section -->
<main class="main-content">
<h2>Welcome to My Website</h2>
<p>This is a simple layout with a header, logo, and navigation bar.</p>
</main>
<!-- Footer Section -->
<footer class="footer">
<p>© 2024 My Website</p>
</footer>
</body>
</html>
CSS Code:
/* Reset some default styles */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
/* Header styling */
.header {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #333;
color: white;
padding: 20px;
}
.logo {
display: flex;
align-items: center;
}
.logo img {
height: 40px;
margin-right: 10px;
}
.navbar ul {
list-style: none;
display: flex;
}
.navbar li {
margin-left: 20px;
}
.navbar a {
color: white;
text-decoration: none;
padding: 5px 10px;
transition: background-color 0.3s ease;
}
.navbar a:hover {
background-color: #555;
border-radius: 5px;
}
/* Main content styling */
.main-content {
padding: 40px;
text-align: center;
}
/* Footer styling */
.footer {
text-align: center;
padding: 10px;
background-color: #333;
color: white;
}