In this Django project, I am iterating over folders and files. Each file should have a different background color - odd ones purple, even ones blue. However, all files are currently displaying as purple.
Below is the HTML for the file div:
<div class="each_key">{{file}}</div>
Here is the CSS styling for the files:
.each_key:nth-child(odd){
text-align: left;
width:197px;
height:42px;
background-color: purple;
padding:10px;
}
.each_key:nth-child(even){
text-align: left;
width:197px;
height:42px;
background-color: blue;
padding:10px;
}
I have also attempted using "nth-of-type" but it still only displays in purple rather than alternating between purple and blue.