add css in html django

To add CSS in an HTML file in Django, follow these steps:

  1. 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.

  2. Inside the static directory, create a folder named "css" to store your CSS files: mkdir yourapp/static/yourapp/css.

  3. Place your CSS file, for example, styles.css, inside the css folder.

  4. In your HTML template file, load the static tag at the top of the file: {% load static %}

  5. 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.