Home > Software engineering >  Why don't bootstrap codes run on my django website?
Why don't bootstrap codes run on my django website?

Time:01-10

Hello

I'm having trouble applying bootstrap to my website in django.

I copied the bootstrap link in the html page and wrote the navbar codes in the body part, but when I hit runserver, the website page doesn't change at all!

where is the problem from? I also installed the bootstrap plugin in Visual studio code, but it still doesn't change anything!

Thank you for your guidance

<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF -8">
    <title> {% block title %} {% endblock %} </title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">

</head>
<body>

    <nav >
        <div >
            <a  href="#">Navbar</a>
        </div>
    </nav>

    {% block content %} {% endblock %}
</body>
</html>

CodePudding user response:

Bootstrap seems to be working for me. You might not be seeing your navbar on the screen because you have a white background and you're using navbar-dark.

<body style="background: red">
    <nav >
        <div >
            <a  href="#">Navbar</a>
        </div>
    </nav>
    ...

Jsfiddle: https://jsfiddle.net/mov0wjsq/23/

As you can see, the navbar's text is white which is why it wasn't showing up.

  • Related