Footer sticking issues, out of place

My multipage website project is coming together, but I'm facing some issues with the footer. While the navbar is behaving as expected on all pages, the footer seems to have a mind of its own. It's inconsistently positioned across different pages, sometimes appearing where it should be and other times getting misplaced even before any content is added.

I've tried various solutions from online sources, but none seem to work so far. HTML:

<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">    
    <link rel="stylesheet" href="css/navFooter.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
    <div id="navbar"></div>
    <div class="col-md-12">
        <table class="table">
            <td style="border: none;"><p>Choose the type of comparison you'd like to make.</p></td>
            <td>
                <b>Quick Comparison</b><br>
                <a href="/a/comparisons?action=indicators&nid=1000...6700">Compare all counties</a><br>
                <b>Custom Comparison</b><br>
                <a href="/a/comparisons">Compare selected counties and/or jurisdictions only</a>
            </td>
        </table>
    </div>
    <div id="footer"></div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script type="text/javascript">
         $(function(){
            $("#navbar").load("navbar.html"); 
        });
        $(function(){
            $("#footer").load("footer.html"); 
        });
    </script>
</body>

CSS:

   html, body {
    height: 100%;
    width: 100%;
}
body { 
    padding-top: 90px; 
    position: relative;
    overflow: scroll;
}
.footer {
    position: absolute;
    margin: 0;
    width: 100%;
    background-color: #19D8FF;
    padding: 25px;
    border-top: 4px solid #3399CC;
    min-height: 150px;
    max-height: 250px;
}

Footer HTML:

<footer class="footer">
    <div class="container">
        <div class="row">
            <div class="col-md-3 pull-left">
                <img src="img/Wordmark.png" alt="Logo">
            </div>
            <div class="col-md-5">
                    <a href="links.html">Links</a> |
                    <a href="contact.html">Contact</a> |                    
                    <a href="apps/azindex.pl">A-Z Index</a> |
                    <a href="siteMap.html">Site Map</a> |
                    <a href="disclaimer.html">Disclaimer</a></li>
            </div>
            <div class="col-md-4">
                 <p class="muted pull-right">© 2017 All rights reserved</p>
            </div>
    </div>
    </div>
</footer>

Answer №1

If you're looking for a solution to position an element at the absolute bottom of your view, this code snippet will guide you in the right direction. By adding 'bottom: 0' and changing the position to fixed, the element will always stay fixed at the bottom.

 html, body {
    height: 100%;
    width: 100%;
}
body { 
    padding-top: 90px; 
    position: relative;
    overflow: scroll;
}
.footer {
    position: fixed;
    bottom: 0;
    margin: 0;
    width: 100%;
    background-color: #19D8FF;
    padding: 25px;
    border-top: 4px solid #3399CC;
    min-height: 150px;
    max-height: 250px;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Effortless Sidebar Navigation for populating primary content

Initially, I must confess that even though this seems like a straightforward issue, I am just as puzzled as you are by my inability to solve it independently. With no prior experience in web development, I find myself in need of using GitHub Pages to docum ...

What could be causing the labels to stay stagnant while the image moves?

What could be causing the labels to remain static while the images (front and back of human anatomy) move on Galaxy S8 and iPhones? Check out the website at . Your assistance is greatly appreciated. ...

The div element should stretch to occupy the entire height of the screen

I have structured my webpage with three different divs. The left one is defined with col-md-2, the middle one with col-md-8, and the remaining right div with col-md-2. I want the right div to take up 100% of the screen height, even when no controls are pre ...

Assistance Needed with XPATH and CSS for Selenium Automation

Can anyone assist me in finding the appropriate XPATH/CSS locator to extract text from the structure below? <div class="page-header song-wrap"> <div class="art solo-art"> <div class="meta-info"> <h1 class="page-title"> Zehnaseeb I ...

When the page is zoomed in, the Bootstrap navbar overlaps with

I'm currently in the process of developing a website that includes a navbar with a navbar-fixed-top class. Everything seems to be working perfectly except for when I zoom in. On mobile devices, when I zoom in, the navbar starts wrapping and goes to th ...

The column flex-direction property seems to be malfunctioning

Can anyone help me with styling a ul tag using display: flex? I'm trying to order it by column with flex-direction: column;, but for some reason, it's not working. Here is the CSS code for the container: #nav li.four_columns ul.sub-menu { widt ...

Issue with maplace.js preventing the display of the Google map

I have followed the setup instructions found at . After loading the maplace.js file on my server, I incorporated the provided code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>minimal maplace</title> < ...

Issue with CSS margin-top not displaying properly in Firefox and Internet Explorer, but working fine in Chrome and Opera

I'm encountering difficulties with the margins on my website. It seems like margin-top isn't functioning properly in Firefox and IE, even though it is working correctly in Chrome and Opera. Despite trying various techniques and searching online f ...

Choose a trio of columns using jQuery

Is it possible to target three specific columns using jQuery or CSS, like this: Take a look at the example code below: <script> //I am attempting to target specific columns with this code snippet $('GvGrid').slice(1, 3).css("backgroundC ...

What steps should I take to transition from a 302 temporary to a 301 permanent redirect code?

I am facing an issue with a 302 temporary code on one of my websites. I have been able to identify the code, but unfortunately, I am struggling to locate it. Can someone please help me find where the code is located and guide me on how to change it from ...

Display an error alert when a specific condition occurs

My page has a code snippet that triggers an error alert when loaded: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["message"] == "noemployees") ...

Images in the center with a div overlay on top

I'm attempting to place a div or span on top of an image that is positioned above another image. Both images are centered and resized to fit. The height of my images is greater than the width, but they are not set at a fixed size. I want the div to pe ...

Why doesn't AngularJS validation function properly with input elements of type "number"?

Struggling with Angularjs validation here. Ng-pattern seems to work fine only when the input type is text. However, when the input type is number, ng-pattern doesn't seem to work, although required, min, and max attributes still function. <input t ...

What is the best way to attach a CSS class using an onclick function?

I need to dynamically apply a CSS class to a specific div when clicked using JavaScript. Here is the HTML structure: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv=&qu ...

The background image is being cropped outside the item. What steps should I take to display it properly?

I am facing an issue with positioning a background image just outside the lime container. When I position it correctly, any part of the image that extends beyond the container gets cut off. How can I display the whole image even if it is outside the conta ...

Stop jQuery from resetting the background image when using fadeOut()

Currently, I am using fadeIn and fadeOut functions with jQuery to create a fading effect. However, when the final fade out occurs, the entire CSS table fades out and the background image of the CSS body comes into view. Despite setting the background-posit ...

How to Achieve an Overlapping Background Image Effect with Divs Using HTML and CSS

Is it possible to achieve the following scenario using just HTML and CSS? I want to display the background image of my HTML body through a clipped div. Keep in mind that the final website needs to be responsive (mobile-first), so any solution should accom ...

Execute function during page loading with and without the use of an update panel

Let's consider the following scenario: I have a situation where some pages use a master page. Some of these pages contain an update panel while others do not. I have a jQuery code that needs to be executed when a user triggers the keydown event. $(d ...

What is the method to set up the "materializecss" modal with the "before" (beforeload) feature?

Trying to implement the modal functionality in my project using the materializecss framework but facing some challenges. I have created a popup modal for an image with the code below: HTML: <div class="media-insert"> <a href="#img2" class="moda ...

Troubleshooting a Problem with the Horizontal Scrollbar in Dynamic jqGrid

Currently, I am working on an ASP.net MVC project where I have implemented both dynamic and static jq grids. However, I am encountering an issue with the horizontal scroll bar in my application. To address this problem, I attempted to modify the overflow ...