fix navbar on mobile

This commit is contained in:
Jay 2015-09-18 18:45:55 +02:00
parent 27b59b460c
commit 1eb23fd046
2 changed files with 29 additions and 12 deletions

View File

@ -11,3 +11,20 @@
background-color: #f2dede;
border-color: #eed3d7;
}
/* This is a fix for the bootstrap4 alpha release */
@media (max-width: 47.9em) {
.navbar-nav .nav-item {
float: none;
width: 100%;
display: inline-block;
}
.navbar-nav .nav-item + .nav-item {
margin-left: 0;
}
.nav.navbar-nav.pull-right {
float: none !important;
}
}

View File

@ -34,27 +34,27 @@
<div class="m-b-lg">
<nav class="navbar navbar-dark navbar-static-top bg-inverse">
<div class="container">
<a class="navbar-brand" href="/">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
<a class="navbar-brand" href="/">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
<button type="button" class="navbar-toggler hidden-sm-up pull-right" data-toggle="collapse" data-target="#bs-navbar-collapse-1">
&#9776;
</button>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-toggleable-xs" id="bs-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="nav-item"><a class="nav-link" href="{% url 'home' %}">Home</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'about' %}">About</a></li>
</ul>
<nav class="nav navbar-nav">
<a class="nav-link nav-item" href="{% url 'home' %}">Home</a></li>
<a class="nav-link nav-item" href="{% url 'about' %}">About</a></li>
</nav>
<ul class="nav navbar-nav pull-right">
<nav class="nav navbar-nav pull-right">
{% if request.user.is_authenticated %}
<li class="nav-item"><a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'account_logout' %}">{% trans "Logout" %}</a></li>
<a class="nav-link nav-item" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a></li>
<a class="nav-link nav-item" href="{% url 'account_logout' %}">{% trans "Logout" %}</a></li>
{% else %}
<li class="nav-item"><a class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'account_login' %}">{% trans "Log In" %}</a></li>
<a class="nav-link nav-item" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a></li>
<a class="nav-link nav-item" href="{% url 'account_login' %}">{% trans "Log In" %}</a></li>
{% endif %}
</ul>
</nav>
</div>
</div>
</nav>