Why is a CSS file not changing the colors of HTML tags on Django project?


I’ve been working on adding css styles to my django web project, but I noticed something odd I can’t understand.

My page is succesfully adding or removing a gif when I add it or remove it in my css file, but the color of my labels, for instance, doesn’t change. This is my simple css file that works this way:

li a {
    color: green;
body {
    background: white url("images/background.gif") no-repeat;

When in my browser, I can see if I delete the second statement, the gif no longer appears, but whether I delete or not the first one, all text is still black. I also tried this:

h1 a, h2 a {
     color: #C25100;

But it works the same, it doesn’t change any text, and the document has many different tags, and none is affected.

I include the css in my html file like this:

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

When I first figured it out, I had bootstrap linked too, but I removed it and it changed nothing.


Color isn’t changing because h1 a means a inside h1. I guess you should change that to h1, a this means h1 and a. Read more here.

Answered By – Faisal Manzer

Answer Checked By – Terry (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.