1👍
✅
You have referred the stylesheet as follows in your template:
<link href="static/css/main.css" rel="stylesheet">
Here static/css/main.css
is a relative url that starts from the current page not from the root. If the url is supposed to be from the root of the website relative urls should have a leading slash (/
), hence you should have written:
<link href="/static/css/main.css" rel="stylesheet">
Better yet you should simply use the static
template tag [Django docs]:
<link href="{% static 'css/main.css' %}" rel="stylesheet">
Source:stackexchange.com