I can add and edit css styles on base.html file.
I have another file index.html, which extends from ‘base.html’ using django.
However, i dont know why the css code doesnt work for index.html.
the base.htm file
type or paste code here
{% load static %}
{% load blog_tags %}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script defer src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" integrity="sha384-rOA1PnstxnOBLzCLMcre8ybwbTmemjzdNlILg8O7z1lUkLXozs4DHonlDtnE7fpc" crossorigin="anonymous"></script>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="{% static 'blog/css/style.css' %}">
<title>
{% block title %}
{% endblock title %}
</title>
</head>
<body>
<nav class="navbar navbar-expand-lg " style="background-color:#5e8fc1">
<div class="container-fluid">
<a class="navbar-brand" href="{% url 'homescreen' %}">Main</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Переключатель навигации">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{% url 'homescreen' %}">Главная</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Ссылка</a>
</li>
</ul>
<ul class="navbar-nav mb-2 mb-lg-0">
<li class="nav-item">
<form class="d-flex" role="search">
<input class="form-control me-2" type="search" placeholder="Поиск" aria-label="Поиск">
<button class="btn btn-outline-success" type="submit">Поиск</button>
</form>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Sign in</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Sign up</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Hello, User
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">My Account</a></li>
<li><a class="dropdown-item" href="#"> Blog</a></li>
<li><a class="dropdown-item" href="{% url 'add-article' %}">Write an article</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Sign out</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<br>
<div class="row" >
<div class="col-lg-4" >
<a href="{% url 'blogs' %}" class="text-dark m-2"> <i class="fas fa-flask"></i> Blog </a>
{% get_categories as categories %}
{% for category in categories %}
<a href="{% url 'category-view' category.pk %}" class="text-dark m-2"> <i class="fas fa-flask"></i> {{ category.title }} </a>
{% endfor %}
</div>
</div>
{% block main %}
{% endblock main %}
<script src="{% static 'blog/js/snow.js' %}"> </script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>
The index.html file
{% extends 'base.html' %}
{% load static %}
{% load blog_tags %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel='stylesheet' href="{% static 'blog/css/style.css' %}">
{% block title %}
{{ main_page }}
{% endblock title %}
{% block main %}
<div class="hero-section" style="background-image: url(https://cdn.trend.az/2024/09/09/air-products.png);
height:750px;
background-repeat:no-repeat;
background-size:cover;
"
>
<div class="row">
<div class="col-6">
<h1 style="margin-top:150px" ><strong>Industrial Gas Supplier</strong></h1>
</div>
</div>
</div>
<br>
<br>
<div id="carouselExample" class="carousel slide">
<div class="carousel-inner">
<div class="carousel-item active" >
<img src="https://www.newscentralasia.net/wp-content/uploads/2023/09/air-products-co.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="https://www.gasworld.com/cdn-cgi/image/width=1200,height=900,fit=contain,quality=75,metadata=none,format=auto,gravity=auto/https://www.gasworld.com/wp-content/files/gwml/actros2545airproducts21_185696.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExample" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExample" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<!--<div class="container">-->
<!-- {% for article in articles %}-->
<!-- <div class="card mt-4 mb-4">-->
<!-- <div class="d-flex justify-content-center">-->
<!-- <div class="col-3">-->
<!-- <a href="{% url 'article-view' article.pk %}">-->
<!-- <img height="200px" src="https://media.istockphoto.com/id/1354826805/vector/data-science.jpg?s=612x612&w=0&k=20&c=FKYxpsaWX7H5_DEX4t0dV2o837_aqgoavlIRdIz1jwE=" alt="">-->
<!-- </a>-->
<!-- </div>-->
<!-- <div class="col-9 p-4">-->
<!-- <a href="{% url 'article-view' article.pk %}" class="text-dark"><h3> {{ article.title }} </h3></a>-->
<!-- <p>{{ article.description }}</p>-->
<!-- <span class="small">{{ article.created_at }}</span>-->
<!-- <p> {{ article.category }} </p>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- {% endfor %}-->
<!--</div>-->
{% endblock main %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
the style.css file
.ball {
position: absolute;
border-radius: 100%;
opacity: 0.7;
}
#carouselExample {
height: 300px;
width: 300px;
}
The applied style and js code on base.html are working great. But they dont work for index.html
I uploaded all the routes, wrote the code in settings.py correctly. But still now working for index.html