Django/Bootstrap: experiencing issues with certain default styles not functioning correctly like nav-tabs and buttons

When using Django in combination with Bootstrap v5, I am encountering an issue where the "nav-tabs" class is not being styled as tabs and gray buttons are not taking on the pill style. It appears that only a portion of Bootstrap is functioning correctly. What could be causing this discrepancy?

I attempted to switch between Bootstrap versions 4 and 5, but the issue persisted.

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

<!DOCTYPE html>
{% load static %}
<html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
        <script src="{% static 'js/bootstrap.min.js' %}"></script>
    </head>
    <body>
        <div class="text-center bg-primary text-white">
            <h3>My Site!</h3> 
        </div>
        
        <div class="container-fluid text-center">
            
          <ul class="nav nav-tabs">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#">Menu 1</a></li>
            <li><a href="#">Menu 2</a></li>
            <li><a href="#">Menu 3</a></li>
          </ul>
        </div>

        <div class="container">
          <div class="row">
            <div class="col-sm-4">
              <h3>Filter</h3>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
                  <button type="btn btn-outline-primary">Reset</button>
                  <button type="btn btn-outline-primary">Filter</button>
              <div class="alert alert-success alert-dismissible">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                <strong>Success!</strong>
                </div>
            </div>
            <div class="col-sm-4">
              <h3>Select View</h3>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
            </div>
            <div class="col-sm-4">
              <h3>Chart</h3>        
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
            </div>
          </div>
        </div>       
    </body>
</html>

Answer №1

Alright, the reason why the tabs are functioning is because both the unordered list and each line item have specific classes defined in their syntax as shown below...

<ul class="nav nav-tabs">
<li class="nav-item">
    <a class="nav-link active" href="#home">Home</a>
</li>
<li class="nav-item">
    <a class="nav-link" href="#menu1">Menu 1</a>
</li>
<li class="nav-item">
    <a class="nav-link" href="#menu2">Menu 2</a>
</li>
</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

Optimal techniques for leveraging CSS within Mui and Reactjs

Just starting out with mui, I'm currently working on styling CSS for mui components like so <Typography variant="h5" sx={{ fontWeight: "bold", color: "#1a759f", display: "flex", ...

The Bootstrap card is elegantly framed by a crisp white border surrounding the

After referencing a tutorial, I implemented the following code: <div class="card" style="width:400px"> <img class="card-img-top" src="image.png" alt="Card image"> <div class="card-body"> <h4 class="card-title">John Doe</ ...

CSS code for creating thumbnail images that enlarge when hovered over

I currently have a series of thumbnails in a row (within container elements) set to float left. These thumbnails are resized to fit neatly within the row. <style type="text/css"> .thumbnails{ float:left; position:relative; } ...

How can I retrieve all users from LDAP using python and django?

Environment: python - 3.6.6 django - 2.x.x django-auth-ldap - 2.0.0 python-ldap - 3.2.0 Code Snippet: import ldap from django_auth_ldap.backend import LDAPBackend, _LDAPUser, LDAPSearch user = _LDAPUser(LDAPBackend(), "any") # establishing r ...

Create a loop in JavaScript to iterate through elements using both a while loop and the

I have a JSON object (returned by the server) and I am looking to iterate through it with either a while loop or forEach method in order to display the products in a shopping cart. The name of my object is response2, which contains the cart products. I w ...

How can I place this ribbon on top of an image in an HTML email to ensure it displays correctly on email clients such as Outlook?

As I delve into my research, it's becoming apparent that achieving this result might not be feasible across all email clients. However, I'm curious to know if there have been any recent developments in the email world that would allow me to repli ...

What is the method for indicating the bootstrap version in the Laravel/ui package?

I am currently incorporating Bootstrap into my Laravel project with the help of the laravel/ui package. If you are interested, you can check out the laravel/ui GitHub repository at https://github.com/laravel/ui. I am following the setup instructions by ru ...

Make your CSS and JS files smaller by using a PHP compression script in your WordPress child theme

  I am looking to implement a PHP script that will serve combined, pre-gzipped, and minified JS and CSS files. You can find the source code for this script here: https://code.google.com/p/compress/ I have a WAMP localhost with WordPress install ...

Issues arise when trying to integrate iframes with Ionic and AngularJS, as they

Using iframes in my ionic app to display webpages within the application has presented a challenge. This is what I currently have implemented: <iframe class= 'webPage' name= "eventsPage" ng-src="{{object.url}}"></iframe> The issue ...

How is it possible that this component is able to work with slotting without needing to specify the slot name

I have created two Web Components using Stencil.js: a Dropdown and a Card. Within my Dropdown, the structure is as follows: <div class='dropdown'> <slot name="button"/> <slot/> </div> The nested chil ...

Grails is experiencing a surge of duplicate events being triggered simultaneously

In my _test.gsp layout, I have a 'click event' that is triggered when the layout is rendered as shown below. <div id="testid"> <g:render template="test"/> </div> When I click on the event in the _test.gsp layout, it trigge ...

Encountered an error in Angular1: TypeError - promise.catch does not exist as a

Upon using angular-ui-router, I encountered the following error while clicking on the links view1 and view2 in index.html. The same example worked with the regular angular router. Is there something missing in the code? Thanks. TypeError: promise.catch i ...

What impact does including a parent View Tag have on the styling in React Native?

Why does adding a View parent break my styles? Could React Native's View tag have default styles that I'm not aware of? Displayed below is the Button component along with screenshots demonstrating the difference when using and not using the View ...

Utilizing PNG images with color in CSS, HTML, or JavaScript

On my website, I have an image in PNG format. I am wondering if there is a way to change the color of the image using HTML5, JavaScript, or CSS. Ideally, I would like the image to be changed to white by inverting its colors (changing black to white, not al ...

Guide on enabling the scrollbar within a text area while utilizing the pointer-events: none property

After applying the CSS rule pointer-events: none to the text area, I noticed that the scrollbar was disabled. I need the scrollbar to remain enabled so that users can scroll and view the entire content, while still preventing editing within the textarea u ...

Combining Django Rest Framework categories and their subcategories under one model

I am facing a seemingly simple issue at first glance. The scenario is as follows - a product can be sold in multiple places (shops), and each product can have different categories and subcategories within a single shop (hence the use of ForeignKey with Ass ...

Aligning a child div within a parent div using HTML/CSS where the child div takes up 30% of the parent div and

Can anyone help me figure out why these two INPUT elements aren't aligning next to each other? I appreciate any assistance you can offer! <STYLE> html, body { width: 100%; height: 100%; margin: 0px; padding: 0px; } </STYLE& ...

JavaScript code encounters a math calculator script error

Am I overlooking something in my script? Everything seems to work fine when I click the minus (-) button, but when I press the plus (+) button, the calculator malfunctions. It displays 1, 11, 21, and so on, all ending with 1... Here is my code: functi ...

Challenges may arise when utilizing a variable query to showcase the outcomes within a div using ajax

Please assist me with this issue! How can I assign the value of a variable from a PHP file for comparison in my query? 2. The syntax is not correct. 3. Can I print data within the same div as "success" on my office's shed? ------ Contents of index.ht ...

Retrieve all HTML elements, including their closing tags, from a file with Java, without relying on external libraries such as Jsoup

Recently, I've been working on a piece of code that reads an HTML file, extracts all the opening HTML tags, and displays them. However, I have been thinking about how to also include the closing tags in the output. At the moment, the code prints: < ...