This method makes the footer always visible, even when scrolling.
footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
width: 100%;
z-index: 999; /* Ensures the footer appears above other content */
}
Explanation:
position: fixed;
takes the footer out of the normal document flow and positions it relative to the viewport.bottom: 0;
left: 0;
right: 0;
anchors the footer to the bottom edge and spans it across the full width.z-index
ensures the footer remains on top of other content.
Important Considerations:
-
Content Overlap:If using
position: fixed
, ensure your main content has enough padding at the bottom to prevent the footer from obscuring it. -
Theme Specifics:The exact CSS selectors (
body
,main
,footer
) might vary slightly depending on your WordPress theme. Inspect your site’s HTML to identify the correct selectors.