Published
- 1 min read
how to add an active class to current element in navbar in django
The solution for this is noted below
how to add an active class to current element in navbar in django
Solution
<li {% if request.resolver_match.url_name == 'home' %}class="active"{% endif %}>
<a href="/">HOME</a>
</li>
Try other methods by searching on the site. That is if this doesn’t work