0

Good afternoon everyone, I have some issues with Bootstrap. I would like to get two buttons "Log In" and "Sign Up" at the right of the page but they are still at the left while I mention class="text-end" which is supposed to align my buttons to the right. Anyone could have an idea, I am stuck.

<html>

<head>
    <meta charset="utf-8">
    <title>{% block title %}Newspaper App{% endblock title %}</title>
    <meta name="viewport" content="width=device-width,
  initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>

<body>
    <div class="container">
        <header class="p-3 mb-3 border-bottom">
            <div class="container">
                <div class="d-flex flex-wrap align-items-center justify-content-center
          justify-content-lg-start">
                    <a class="navbar-brand" href="{% url 'home' %}">Newspaper</a>
                    <ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
                        {% if user.is_authenticated %}
                        <li><a href="#" class="nav-link px-2 link-dark">+ New</a></li>
                    </ul>
                    <div class="dropdown text-end">
                        <a href="#" class="d-block link-dark text-decoration-none dropdown-toggle" id="dropdownUser1"
                            data-bs-toggle="dropdown" aria-expanded="false">
                            {{ user.username }}
                        </a>
                        <ul class="dropdown-menu text-small" aria-labelledby="dropdownUser1">
                            <li><a class="dropdown-item" href="{% url 'password_change'%}">
                                    Change password</a></li>
                            <li><a class="dropdown-item" href="{% url 'logout' %}">Log Out</a></li>
                        </ul>
                    </div>
                    {% else %}
                    <div class="text-end">
                        <a href="{% url 'login' %}" class="btn btn-outline-primary me-2">Log
                            In</a>
                        <a href="{% url 'signup' %}" class="btn btn-primary">Sign Up</a>
                    </div>
                    {% endif %}
                </div>
            </div>
        </header>

        <main>
            {% block content %}
            {% endblock content %}
        </main>
    </div>

    <!-- Bootstrap JavaScript Bundle -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
        crossorigin="anonymous"></script>
</body>

</html>[enter image description here](https://i.stack.imgur.com/19L7D.png)

I read the documentation, tried to reinstall some packages but I don't know what to do anymore.

Thanks in advance, have a nice week.

dekozr
  • 1
  • 1
  • These classes apply `text-align`, and that works on text and inline content. A `div` is neither of those. – CBroe Jan 23 '23 at 14:04
  • Thanks for your help. I tried using "justify-content-end" that is supposed to work with div but It was not working as well. Do you know what is the correct argument? – dekozr Jan 23 '23 at 15:22
  • Try https://stackoverflow.com/questions/41513463/bootstrap-align-navbar-items-to-the-right – CBroe Jan 24 '23 at 07:00

0 Answers0