Unable To Apply CSS On My HTML File Django
I have seen alot of solutions here regarding this issue but unable to resolve my problem, I am trying to apply my style.css present on this path \...\static\css I have following di
Solution 1:
You don't need to do css/style.css
<html lang="en">
<head>
{% load static %}
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link rel="stylesheet" href="{% static 'style.css' %}" />
<link rel="style**strong text**sheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<title>{% block title %}My Website Name{% endblock %}</title>
</head>
Solution 2:
I am able to resolve the issue by updating the following line in settings.py
STATIC_DIR = os.path.join(BASE_DIR, 'Aqi_dash/static')
and I have also update the following code in html file:
link rel="stylesheet" href="{% static 'style.css' %}"
and i am able to successfully apply the css on my index.html
Post a Comment for "Unable To Apply CSS On My HTML File Django"