Certainly! Below is the complete code for a Bootstrap-styled navbar with improved custom styles to give it a refined appearance. Make sure you have Bootstrap properly linked in your HTML for this code to work correctly, and adjust color codes and other properties to match your branding.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Django Club Home</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Your custom CSS goes after Bootstrap CSS -->
<style>
.custom-navbar {
background-color: #333; /* Adjust to your preferred color */
}
.navbar-brand {
font-weight: bold; /* Makes the brand font bolder */
color: #fff; /* Adjust to your preferred color */
}
.navbar-nav .nav-item .nav-link {
color: #ccc; /* Adjust to your preferred inactive link color */
transition: color 0.3s ease;
}
.navbar-nav .nav-item .nav-link.active,
.navbar-nav .nav-item .nav-link:hover {
color: #fff; /* Adjust to your preferred active/hover link color */
background-color: rgba(255, 255, 255, 0.1); /* Optional: change background on hover */
}
.dropdown-menu {
background-color: #444; /* Adjust to your preferred dropdown background color */
}
.dropdown-item {
color: #ccc;
transition: background-color 0.3s ease, color 0.3s ease;
}
.dropdown-item:hover,
.dropdown-item:focus {
background-color: #555; /* Adjust to your preferred dropdown item background color */
color: #fff;
}
.form-control,
.btn {
margin-top: 0.5em; /* Align with nav items */
}
/* Optional: Custom style for the search input */
.form-control {
border: 1px solid #555;
background-color: #222;
color: #ddd;
}
.btn-dark {
background-color: #555; /* Adjust to your preferred button color */
border-color: #555;
}
.btn-dark:hover,
.btn-dark:focus {
background-color: #666;
border-color: #666;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top custom-navbar">
<div class="container-fluid">
<a class="navbar-brand mb-0 h1" href="{% url 'home' %}">Django Club</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<!-- Insert your navigation links here -->
</ul>
<!-- Conditional add of search form if the user is authenticated -->
<!-- Insert your search form here if applicable -->
</div>
</div>
</nav>
<!-- Your content goes here -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Don't forget to replace the placeholder comments -- like "<!-- Insert your navigation links here -->" and "<!-- Insert your search form here if applicable -->" -- with your actual templates and code.
The provided code uses Bootstrap 4. If you're using Bootstrap 5 or another version, make sure to import the correct Bootstrap files and adjust any class names or data attributes accordingly, as there might be minor differences between versions. Remember that the hex colors and other CSS properties need to be edited to align with the design you wish to achieve.