Issues arise when attempting to affix the navigation bar to the top of the webpage

After running the code below, I noticed that my navbar is not behaving as expected and seems to be stuck in the middle of the screen instead of being fixed to the top. This is confusing for me because I have created navbars before that worked fine. Any assistance on fixing this issue would be greatly appreciated!

<body>
    <div class="container-fluid">
    <nav class="navbar sticky-top navbar-expand-lg navbar-dark bg-dark">
      <div class="container">
        <div class="navbar-nav align-items-center">
          <a class="navbar-brand bigbrand" href="{% url 'post_list' %}">My Tech blog</a>
          <a class="nav-item nav-link" href="{% url 'about' %}">About</a>
          <a class="nav-item nav-link" href="https://www.github.com">Github</a>
          <a class="nav-item nav-link" href="https://www.linkedin.com">LinkedIn</a>
        </div>
        <div class="navbar-nav ml-auto">
          {% if user.is_authenticated %}
            <a class="nav-item nav-link" href="{% url 'post_new' %}">New Post</a>
            <a class="nav-item nav-link" href="{% url 'post_draft_list' %}">Drafts</a>
            <a class="nav-item nav-link" href="{% url 'logout' %}">Log out</a>
            <a >Welcome: {{ user.username }}</a>
          {% else %}
            <a class="nav-item nav-link" href="{% url 'login' %}" aria-label="Login">
              <span class="fa fa-user" aria-hidden="true"></span></a>
          {% endif %}
        </div>
      </div>
    </nav>
  </div>


    {# The actual blog posts#}
          <div class="content container-fluid">
                  <div class="col-md-8">
                    <div class="blog_posts">
                      {% block content %}
                      {% endblock %}

                    </div>
                  </div>
              </div>
    {# SCRIPTS#}
    <script type="text/javascript" src="{% static 'js/blog.js' %}"></script>

  </body>
</html>

This is an image showing the output:

https://i.sstatic.net/xpGRa.png

Answer №1

modify

<nav class="navbar stuck-top navbar-expand-lg navbar-dark bg-dark">

update to

<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Switch between GeoJSON layers by using an HTML button within Mapbox GL JS, instead of relying on traditional links

I am currently developing a web map that requires toggling two GeoJSON layers on and off. In the past, I used Mapbox JS to accomplish this task by adding and removing layers with a custom HTML button click. However, I am facing some challenges in achieving ...

"Varying hues on various displays: Exploring RGB values and CSS for video color

Recently, I designed a webpage with a background-color of #f4afac. The video embedded in this page also features the same background color throughout, creating a seamless blend with no visible edges. On one screen, the colors appear perfectly consistent. ...

Deleting a property from a newly created element in CKEditor

Is there a way to remove the attribute/class of a newly created element using the enter key press event in CKEditor? The version of CKEditor I am using is 4.3 and here is the code snippet: <p placeholder="start here.." class='test'></p& ...

Generate unique identifiers in HTML

Below is my HTML and JavaScript code: <!DOCTYPE html> <html> <head> <style> .custom-div { border: 1px solid green; padding: 10px; margin: 20px; } </style> <script> ...

Displaying information from a Node.js server on a React frontend

I have a question about building a simple REST API with Node.js and fetching mock data to render in React. Here is my progress so far: Node.js: const Joi = require("@hapi/joi"); const express = require("express"); const cors = require("cors"); const app ...

Using a for-loop to read inputs from a database in PHP

I am seeking assistance with a problem I am encountering on an input page (the modified user profile). On this page, I have a section for addresses and need to implement a loop where each set of inputs displays the information for each address individually ...

What is the best approach to modify margin and padding in CSS?

My div has the following CSS rules: #slogan{ font-size:24px; position:absolute; left:0; right:0; margin-left:auto; margin-right:auto; } The last four styles are used to center the content in the div on the page. However, if the p ...

Different hover effects for Material-UI [v0.x] RaisedButton

Is there a way to customize the hover styling of a Material-UI RaisedButton? It seems that the design guidelines dictate what happens on hover, but is there a method to modify the button's color and background-color specifically for when it is being h ...

Can you explain the difference between save_model and save_formset functions in Django admin?

Exploring the functionality of save_model and save_formset in the django admin interface. For more information, visit https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model I am puzzled about the timing of whe ...

Issues with external javascript link functionality

I'm having trouble connecting my external JavaScript file to my HTML code. I'm attempting to concatenate two strings using an input function and then display the new string in the empty text field. What could be causing this issue? Appreciate an ...

"Choosing the text within an <a> tag: A step-by

I am dealing with the a tag. <a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b4c7dbd9d1f4d9d5ddd89ad7dbd9">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" ...

Conquer the issue of incessant AJAX page refreshing

Currently, I am working on an application where I handle numerous form submissions and utilize ajax to send data to a server running on Node.js. One of the features includes updating a table upon button click, which triggers a spinner to load as an indic ...

When using Django-rest-framework, the Browsable API is unable to receive POST data through an HTML form, but is able to retrieve it from Raw data

So here's the issue. When I submit my data through the HTML form, a new record is created in the database but all the passed data is null, as depicted in the image. submit response through HTML form However, if I use the "raw_data" interface, everyt ...

code snippet for showing list items on separate lines

I'm having difficulty getting my templatetag to function properly. I suspect it may be due to the syntax or how I'm calling app_filters. Please bear with me as I am still learning web application development, so feel free to correct me if my logi ...

Create animations for SVG paths and polygons that move along specified paths

I am trying to animate both a path and a polygon in an SVG arrow along the same path. Currently, I have successfully animated the path using CSS, but I am struggling to figure out how to move the polygon along the path at the same pace. <svg id="La ...

Angular ng-show does not seem to evaluate properly

After receiving the JSON array object below: "Tools": [ { "name": "Submit a Claim", "position": 1, "isOn": true, "alert": null }, { "name": "My Recurring Claims", "position": 2, "isOn": true, "alert": null }, { "name": "Online Enrollment ...

Creating a dynamic page footer for a PDF document using Rotativa's content generation capabilities

As I work on generating a PDF, my employer has requested that I add a footer to each page of the document. Currently, the PDF is being created using Rotativa, where an HTML page is converted into a PDF. However, I am facing a challenge in determining the ...

Is there a way to replace the entire div using page.replace_html instead of just

One issue I'm facing with my website is that the navigation is housed within my <%= render 'layouts/header' %>. I am interested in incorporating ajax so that when a user clicks on a navigation link, only the div with id="content" refre ...

The absence of Bootstrap icons within the React JS project is noticeable

Upon creating a React project using the command below: npx create-react-app project I proceeded to install Bootstrap 4.3.1 through npm and imported it into my index.js file... import React from 'react'; import ReactDOM from 'react-dom&apo ...

Crafting a lively piece of content within a written passage

My goal is to create a unique dynamic portion of text within a paragraph. I am struggling to develop an in-line div (or span) that can hold elements like an unordered list or multiple spans which can be vertically adjusted to display. Imagine a window with ...