The Bootstrap Navbar prefers not to display dot separators between its elements

I am currently working on a website using Django 3.1.2 and Bootstrap 4.5.3, but I'm encountering some problems with the navbar.

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

My goal is to have the links aligned to the right with middle dots separating them. I tried using this CSS code snippet, but it's not displaying the dots:

.navbar-nav .nav-item:not(:last-child) {
   content: "\00B7";
   padding-right: 35px;
}

Here is how the corresponding section looks in the HTML:

<div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav ml-auto">
            <li class="nav-item nav-link">      
            <a href="{% url 'blog:about' %}" class="menu">About</a>
        </li>
        <li class="nav-item nav-link">  
            <a href="{% url 'blog:teachers' %}" class="menu">Teachers</a>
        </li>
        <li class="nav-item nav-link">  
            <a href="#" class="menu">Calendar</a>
        </li>
        <li class="nav-item nav-link">  
            <a href="{% url 'blog:projects' %}" class="menu">Projects</a>
        </li>
        <li class="nav-item nav-link">  
            <a href="{% url 'blog:contact' %}" class="menu">Contact</a>
        </li>
    </ul>
    <ul class="navbar-nav ml-auto">
        <li class="nav-item nav-link">  
            <a href="#" class="menu">Student Info</a>
        </li>
        <li class="nav-item nav-link">  
            <a href="#" class="menu">Parent Info</a>
        </li>
        <li class="nav-item nav-link">  
            <a href="#" class="menu">Documents</a>
        </li>
        {% if user.is_authenticated %}
            <a href="#">New Post</a>
            <a href="#">Logout</a>
            <a>Welcome: user.username</a>
        {% endif %}
    </ul>
</div>

Can anyone spot where I might be going wrong?

Answer №1

.main-nav .nav-link:not(:last-child) {
    margin-right: 20px;
}

.main-nav .nav-link:not(:last-child) ::after {
    content: "\2022";
}

The 'content' property is specifically designed to work with the pseudo-elements ::after and ::before.

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

Obtain the form value upon submission without the need to reload the page

I am facing an issue where I have a form and I want to trigger the display of a div (in the same page) and execute a JavaScript function upon clicking submit, all without causing a page refresh. <form action="#" method="post" name= "form1" id = "form ...

What steps can I take to stop the background image from zooming in modal view?

I noticed something strange happening when I open a modal after clicking on an image on my website. The background image seems to zoom in along with the modal, thanks to a new class called .modal-open added to the body element. This class includes addition ...

Tips for reducing the amount of white space on a card featuring a pie chart in a mobile layout

Is there a way to adjust the size of the pie chart or reduce the white space at the bottom? In the mobile view after inspecting with Chrome dev tools, it seems like the chart is not displaying as desired. Here is the screenshot <div ...

Ways to create a div that automatically increases in height to fit its text when the browser size decreases

In the following code snippet, there is a top bar with a lengthy text: <div class="topbar"> <div style="float:left;height:36px;line-height:36px;text-transform: none;"> long text.... </div> </div> Within the topbar ...

Unusual CSS hierarchy observed post AJAX content load

Currently, I am facing a puzzling issue where my CSS rules seem to be losing precedence on a page loaded via AJAX. Despite placing my custom CSS file last in the main page, allowing it to take precedence over any bootstrap styles, after loading new content ...

How to redirect in Django URLconf while keeping the URL's query parameters and handling unicode characters

Typically, URL redirects in URLconf are implemented like this: from django.views.generic.simple import redirect_to urlpatterns = patterns('django.views.generic.simple', (ur'^old/$', 'redirect_to', {'url': ur&ap ...

Having difficulties setting up gunicorn configuration while deploying a Python app on Heroku

Recently, I've come into possession of a Python Django application that needs some reviving. Currently stuck on Python 2.7 with outdated packages, my first step is to get it up and running smoothly on Heroku. Locally, everything works fine, but I&apos ...

Grid sidebar using tailwindcss

I just started using Tailwind CSS, but I'm having trouble understanding how the grid system works! I want my layout to look like this: https://i.sstatic.net/hlHmy.png Here is what I tried, but it's not working as expected: <div class=" ...

Position this menu in the top left corner using HTML and CSS

Is there a way to position the vertical menu completely in the top-left corner without any margin? I've set all margins to 0 but there is still about 2px of space. Any ideas on how to fix this? Thank you in advance! ...

The functionality of the vue2-timepicker package seems to be malfunctioning in vue.js

I am utilizing the vue2-timepicker JavaScript package. npm install vue2-timepicker --save Following that, I import the CSS and datetimepicker component file from node_modules into my main.js file // import the CSS file import 'vue2-timepicker/dist ...

Populate the dropdown menu with data from a JSON file

Recently, I created a custom JSON file and wanted to populate a select>option using this data. However, I encountered an error message saying: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/.../p ...

Tips for aligning content to the right edge

Within a container class, I have a background image set up and divided it into col-6. The first col-6 is currently empty. However, my goal is to add content on the right side of this column. I attempted to achieve this by adding the justify-content-end c ...

Aggregate the data entered into input fields on one page and display them on a separate page

Can you help me with this task? - I have 2 pages set up (page 1 has input fields & page 2 is where the entered data should be displayed) - I want to retrieve all the text input from the first field and insert it into the "content" tag on the second page. ...

Issue with plain CSS animation not functioning in NextJS with Tailwind CSS

I found this amazing animation that I'm trying to implement from this link. After moving some of the animation code to Tailwind for a React Component, I noticed that it works perfectly in Storybook but fails to animate when running in next dev. It si ...

What is the best way to send information to a different webpage?

I am in search of a solution to a rather simple query that has me puzzled. Should this question already exist elsewhere, I humbly request that you guide me to the answer. My apologies in advance if this is a duplicate. I currently have two URLs: http://12 ...

Leveraging the power of the jQuery load function alongside HTML forms in web

Currently in the process of creating a fresh website and considering implementing jQuery's load() function to bring content from various html pages into my main page. load() is functioning smoothly. Below is my current code: Main.html page where cont ...

Tips for positioning a background image behind page content

I have a webpage with a background image, and now I want to add content that floats over it. However, the code below is placing the content behind the image. How can this be corrected? It's important to note that I'm attempting to achieve the ef ...

Unable to automatically calculate JavaScript when the number is not manually typed into the dropdown menu

Calculating A and B vertically from a dropdown combo box has been a challenge. Here is a sample data set: Data A B ---------------------------- 1 | 1 | 0 2 | 0 | 1 3 | 0 | 1 ---- ...

Tips for maintaining the alignment of four buttons in a single row as the size of the screen changes

I'm creating a simple browser game as part of my web development learning process. I have a set of divs that represent a warrior, and at the head of the "div table" I have a group of 4 buttons arranged horizontally. However, when the screen size is re ...

What is the best way to center a div vertically on the page?

I've utilized Bootstrap 3 to create this row: <div class="cart"> <div class="row border"> <div class="col-md-8 desc pad itemsheight"> <div class="col-md-12"> <!-- react-text: 141 -->Docos <!-- /react ...