[Answered ]-CSS doesn't connect to HTML (Django)

1👍

Do like this
base.html

<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
  <!--- Add all your meta tags css files --->
  <title>{% block title %}{% endblock %}</title> 
  {% block extra_head_links %}
  {% endblock %}
</head>
<body>
 
    {% block content %}{% endblock %}
</body>
</html>

inside your index.html

{% extends 'main/base.html' %}
{% load static %}

{% block title %}
  {{title}}
{% endblock %}

{% block extra_head_links %}
  <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
{% endblock %}

{% block content %}
<main>
  <h1>GHBDTN</h1>
  <body>
    <div class="grid-wrapper">
      <header class="grid-header">
          <img class="circles" src="{% static "main/img/main8.jpg" %}" alt="main pic">
          <p>Предоставим качественное образование, <br>
          поможем понять школьную программу, <br>
          улучшить оценки и <br>
          подготовиться к экзаменам</p>
      </header>
    </div>
  </body>
</main>
{% endblock %}

above code will extend all you css from base.html and it will add extra css link on index.html

Leave a comment