Error with Bootstrap's right-aligned navbar functionality

I am currently facing an issue with using Bootstrap classes to align my items to the right in the navbar. I am working on a Django tutorial and incorporating Bootstrap into my HTML page. Below is the code snippet:

<!-- Individual items in the navbar -->
    <div class="collapse navbar-collapse" id="topNavBar"> <!-- This makes the collapse three bar button work -->
        <ul class="nav navbar-nav">
            <li class="active">
                <a href="{% url 'pics:index' %}">
                    <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>&nbsp;
                    Folders
                </a>
            </li>
            <li class="">
                <a href="#">
                    <span class="glyphicon glyphicon-picture" aria-hidden="true"></span>&nbsp;
                    Pictures
                </a>
            </li
        </ul>

        <form class="navbar-form navbar-left" role="search" method="get" action="#">
            <div class="form-group">
                <input type="text" class="form-control" name="q" value="">
            </div>
            <button type="submit" class="btn btn-default">Search</button>
        </form>

        <ul class="nav navbar-nav navbar-right">
            <li class="">
                <a href="#">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&nbsp; Add Folder
                </a>
            </li>

            <li class="">
                <a href="#">
                    <span class="glyphicon glyphicon-off" aria-hidden="true"></span>&nbsp; Logout
                </a>
            </li>
        </ul>

    </div>

Despite implementing the code correctly, the "Add Folder" and "Logout" buttons are not displaying to the right as intended. Instead, they appear next to the search bar. Any assistance or insights on resolving this issue would be greatly appreciated!

Answer №1

Your code looks good, but there seems to be a missing end tag in one of the <li>

<ul class="nav navbar-nav">
          <li class="active">
              <a href="{% url 'pics:index' %}">
                  <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>&nbsp;
                  Folders
              </a>
          </li>
          <li class="">
              <a href="#">
                  <span class="glyphicon glyphicon-picture" aria-hidden="true"></span>&nbsp;
                  Pictures
              </a>
          <li <!--Here--!>
      </ul>

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

Draggable element with a centered margin of 0 auto

Encountering an issue with jQuery UI sortable/draggable where the element being dragged, when centered using margin:0 auto, starts dragging from the left side of the container instead of the center where it is positioned. Check out this demo to see the pr ...

Is there a feature in JavaScript that allows for the creation of URLs?

I created an index view displaying cards (like playing cards) in a grid using BootStrap. Each card is within its own div element, and I implemented a jQuery click handler for each div to open a details page when clicked. The redirect from the index to the ...

Footer not positioned at the bottom of the page

I have been experimenting with different ways to keep my footer at the bottom of the page. Initially, I tried using position: static, but the footer ended up above the bottom of the page and the background was visible (similar to the image below). Then, I ...

What is the process for displaying a list of all files within a folder?

I'm currently working on a project where I have a 'products' directory located in the same folder as my index.html file. My goal is to develop a script that can tally all the jpg files within the 'products' folder and then generate ...

Having trouble with refreshing the div content when using jQuery's $.ajax() function

My goal is to refresh a div that has the id #todos after saving data in the database. I attempted to use .load() within $.ajax() $('.todo--checkbox').change(function () { let value = $(this).data('value'); $.ajax({ url: ...

Is there a way to modify the border shape of items in the navigation bar?

Is there a way to achieve this particular shape when the current page is being displayed? https://i.stack.imgur.com/HELTM.jpg This is how my current code looks: current { transform: skew(-20deg); border: 1px solid white; color: black; background ...

Adjust the transparency of a separate image within a different container by hovering over another image container

Is my goal too complex to achieve? I am attempting to create a hover effect where the opacity of artwork1 and button1 changes simultaneously when hovered over. However, I am having trouble properly labeling my elements and getting them to interact as inten ...

Updating the is_superuser field in Django

A table in my database contains "Reviewers" who are standard Django auth_users, each with a designated superuser status indicated by the is_superuser field (from django.contrib.auth) I created a function to toggle the superuser status of selected reviewer ...

Uninterrupted movement within a picture carousel

Seeking a way to create a smooth transition in an image slider with sliding dividers using continuous switching when clicking previous/next buttons. Currently, the dividers replace each other from far positions. Any ideas on achieving a seamless single mov ...

What is the best way to create an animated, step-by-step drawing of an SVG path

I am interested in creating an animated progressive drawing of a line using CSS with SVG/Canvas and JS. You can view the specific line I want to draw here <svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> <!-- Created with cust ...

Detecting a click outside of a div or its opening button and closing the element using Vanilla JS

When dealing with two buttons, one opens a form, and the other a dropdown. The goal is to have both elements close when clicking outside. The dropdown functionality already works as expected because it closes whenever the user clicks outside the opening b ...

The appearance of my HTML website varies significantly across different devices used by viewers

It's frustrating to see that my HTML website appears differently on various devices. While it looks perfect on mine, my friend is facing issues such as containers being out of place and images not loading properly. I really need to figure this out as ...

What is the best way to show a background image behind the heading text?

I have a strip of images that I want to use as a background for my heading. However, I am encountering an issue where the first and last images of the strip are not displaying properly. Additionally, the image border appears straight instead of following ...

Scroll up and down to witness the enchanting interplay of fading in and out

Looking to expand upon the solution given in this response. The existing code effectively fades in an element while scrolling down and fades out an image when scrolling up; however, it lacks the functionality to fade out when scrolling down. I am aiming ...

Create an interactive HTML table featuring objects as the selected values

I have been attempting to generate an HTML table that is filled with objects. The goal was to make the table selectable by row (via hover), triggering a function when the row is hovered over. Here are the table headers stored in an array: var topTitles ...

Ensure Password is Secure (Django/Python)

I'm currently working on a small Django app for educational purposes, utilizing the built-in User model provided by Django. My focus is on learning its features and functionality. In order to interact with users, I've created custom pages that al ...

Is your href in javascript not functioning properly?

Recently, I completed the development of a mobile web application. Overall, everything seems to be working smoothly except for one issue: there is a link with JavaScript in its href that is causing problems. Strangely enough, this link works perfectly fi ...

Change the position of a div by clicking a button using JavaScript

I have a div with an image that I want to move by clicking on a button within the same div. The reason for this is that clicking on the image itself allows it to move inside the div, but I want another element to control the movement of the entire div. He ...

Flowing vertically and horizontally while adjusting line height within the <small> HTML tag

While working on the typography for my new website, I encountered an unusual issue with the <small> tag. It seems to be messing up the line-height, unlike other elements like heading tags and paragraphs. Here's a visual representation of the pr ...

The height of the Material UI Paper component is not appropriately matched with the parent component

I am currently working with the Paper component that contains a Card component, and I am trying to make its height fill the entire screen. To simplify the problem, I have provided the following code: import React from "react"; import { makeStyles ...