Footer not staying at the bottom of the page

140 views Asked by At

I'm in the process of trying to optimize a website I'm working on for mobile users. While working on the site, I noticed that on very small screens (specifically 450px and less wide) my footer breaks and is no longer stuck to the bottom of the page.

I believe the culprit to be something to do with the #viewWrapper div but after inspection through the chrome console and messing around with it (position, physical size, etc..) for a few days I have yet to find a solution to it.

Any help is appreciated. Here is the link to the page in question:
http://mhtc-vm1.cs.wpi.edu:8080/test/explore

Structure of the page:

<body>
    ...
    <div class="container-fluid-full">
        ...
        <div id="content">
            ...
            <div id="viewWrapper">
                ...
            </div>
        </div>
    </div>
    <footer>...</footer>
</body>

Some relative CSS:

@media only screen and (max-width: 450px) {
    #viewWrapper {
        left: 0px;
    }
}

#viewWrapper {
    position: absolute;
    top: 180px;
    left: 450px;
    right: 0px;
    bottom: -160px;
    overflow: hidden;
    border: 0;
    margin: 0;
    outline: 0;
    padding: 0;
    vertical-align: baseline;
    display: block;
}

.site-footer {
    position: relative;
    bottom: 0px;
    left: 0px;
    right: 0px;
    z-index: 999;
    padding: 10px 0px !important;
    clear: both;
    display: block;
}
2

There are 2 answers

0
Rahul On BEST ANSWER

you may want to write

@media screen 
  and (max-device-width: 1024px) {

     #viewWrapper{
        bottom: 0; //apply bottom 0 with media query for small screen only
     } 

 }
0
chop62 On

Use two div tags in footer and give it the style you like they will flow together in screen transition.

    <footer id="colophon" class="site-footer" role="contentinfo">
    <div class="site-info container">
      <p class="copy">&copy; 2016. Worcester Polytechnic Institute. All Rights Reserved. 
      Sponsored by Mass High Technology Council</p>
    </div>
      <div style="float:right;padding-right:20px">
      <a class="footerLinks" href= "api"> For Developers </a>
      <a class="footerLinks" href= "feedback"> Contact Us</a>
      <a class="footerLinks" href= "about"> About Us </a><br />
      </div>
    <!-- .site-info -->
</footer>