I replaced <style> tag in base.html with an external CSS file. In base.html there is a menu which links to different HTML pages. When I click on any menu item, the page is loading but not CSS.
I tried using <link> tag in homealter.html for CSS to work, but it doesn't work.
base.html
<link href="../static/css/base_style.css" rel="stylesheet" type="text/css">
<div class="menu">
<table>
<tr>
{% with request.resolver_match.url_name as url_name %}
<td class="{% if url_name == 'home' %}active{% endif %}"><a href="{% url 'home' %}">Resource Wise Analysis</a></td>
<td class="{% if url_name == 'homealter' %}active{% endif %}"><a href="{% url 'homealter' %}">Land Distance Analysis</a></td>
<td class="{% if url_name == 'graphsone' %}active{% endif %}"><a href="{% url 'graphsone' %}">Water Type Based Analysis</a></td>
<td class="{% if url_name == 'graphstwo' %}active{% endif %}"><a href="{% url 'graphstwo' %}">Land Distance Analysis</a></td>
<td><a href="{% url 'logout' %}">Logout</a></td>
{% endwith %}
</tr>
</table>
</div>
{% block mains %}
{% endblock %}
</body>
homealter.html
{% extends 'base.html' %}
{% block mains %}
{% load staticfiles %}
<link href="../static/css/base_style.css" rel="stylesheet" type="text/css">
<div class="contnt">
<table>
<tr>
<th>Land Size</th>
<th>Land Distances Count</th>
<!--<th>Details</th>-->
</tr>
{% for index, row in yeye.iterrows %}
<tr>
<td><p>{{index}}</p></td>
<td>{{row.Distance}}</td>
<!--<td><a href="{% url 'yearwise' index %}">View Details</a></td>-->
{% endfor %}
</tr>
</table>
<img src="{% static 'images/im1.jpg' %}">
</div>
{% endblock %}
It worked earlier because there was internal CSS in base.html. I need base_style.css to work whenever menu items are selected i.e., in other pages as well.
<link>? When you open page in browser and use Ctrl+U to see source code - do you see this link in HTML ? Copy this link from HTML and open in new card in browser - is it loading ?<link>in div and also at the top, I also created a body tag, but nothing worked so far.<link>in<div>. I see only one link to "../static/css/base_style.css" but it is not external link. Or maybe you mean external folder on disk - browser doesn't have access to external folders on disk for security reason.homealter.html,<link>is not working, and I removed it. I'll add it again.