I’m having a problem setting active states through CSS.
It works if I use body, but because I’m using django, I use templates so it’s impractical to have in every page.
I’m trying to use a div instead, but simply using the same method on div tags doesn’t seem to work, any idea why?
Does it have anything to do with Django?
Why does this work:
body#home a#homeNav,
body#profile a#profileNav,
body#settings_account a#settingsNav,
body#settings_profile a#settingsNav,
#login a#loginNav{
color:white;
}
–
{% extends "base_pages/base.html" %}
{% block content %}
<body id="home">
</div>
{% endblock %}
But this not?
div#home a#homeNav,
div#profile a#profileNav,
div#settings_account a#settingsNav,
div#settings_profile a#settingsNav,
#login a#loginNav{
color:white;
border-top: 3px solid #09F;
}
–
{% extends "base_pages/base.html" %}
{% block content %}
<div id="home">
</div>
{% endblock %}
“FWIW: I usually do something like
Which then allows you to set the class easily in any template. You can even accommodate inheritance, when you set it:
– Chris Pratt”