Lately, I've been working on incorporating a footer into my layout.html file that is inherited by all other pages within my Django project.
I am aiming to create a footer that remains fixed at the bottom of every webpage just like how Stack Overflow does it. My approach would ideally involve using inheritance for efficiency.
Below is my proposed code snippet from layout.html:
HTML:
{% block body %}
{% endblock %}
<div class="test_footer">
Footer Test
</div>
CSS
.test_footer {
width: 100%;
background-color: var(--primary-colour);
padding: 20px;
box-sizing: border-box;
position: absolute;
bottom: 0;
}
The issue I'm facing is that the test_footer
doesn't appear below the rest of my body content. Instead, it initially displays at the bottom of the browser window covering the HTML shown by the body, and then moves up as I scroll.