add css in html django
To add CSS in an HTML file in Django, follow these steps:
Create a static directory in your app's directory if it doesn't exist already. You can do this by running the command:
mkdir -p yourapp/static/yourapp/
in your terminal.Inside the static directory, create a folder named "css" to store your CSS files:
mkdir yourapp/static/yourapp/css
.Place your CSS file, for example,
styles.css
, inside the css folder.In your HTML template file, load the static tag at the top of the file:
{% load static %}
Link your CSS file in the HTML file using the static template tag:
<link rel="stylesheet" type="text/css" href="{% static 'yourapp/css/styles.css' %}">
By following these steps, you can add CSS to your HTML files in Django and ensure that the styles are applied correctly.