I am facing an issue with the footer on my website . I want the footer to always stay at the bottom of the page, even when I dynamically inject HTML code using JavaScript. The footer displays correctly on the main page , but it does not work as intended on other pages like where it is not positioned at the bottom due to changing dimensions caused by live HTML insertion.
Currently, my footer CSS is defined as follows:
footer {
clear: both;
margin-top: -200px;
position: absolute;
bottom: 0;
width: 100%;
height: 2.5rem;
text-align: center;
}
In addition to staying at the bottom, I also need the footer to remain centered on the page.
Any ideas or suggestions would be greatly appreciated. Thank you!