Answers for "create active links on click"

2

active link

# Foward slash is equal to homepage. For all others you use IN keyword.
<li 
  {% if '/' == request.path %}
  	class="nav-item active mr-3"
  {% else %}
  	class="nav-item mr-3"
  {% endif %}
>

<li 
  {% if 'about' in request.path %}
      class="nav-item active mr-3"
  {% else %}
      class="nav-item mr-3"
  {% endif %}
>
Posted by: Guest on November-24-2020
0

active link

#top-menu .current a
{
    color: orange !important;
}
Posted by: Guest on June-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language