0

I have some problems with sticking my footer to the bottom of the page. At the moment when I preview it in Internet Explorer, it is centered under the rest of the content, but not at the bottom. When I want to preview it in Chrome, it keeps standing next to some other content. Could someone explain to me why and how to fix this? Below, I've included some code for reference:

HTML:

<footer class="mainFooter">
                <p>Copyright &copy; <a href="https://www.google.nl">www.baica.nl </a></p>
            </footer>

CSS:

.mainFooter{
    display:block;
    width:100%;
    height:50%;
    margin:20% auto;
    color:yellow;
    text-align: center;
}
Hari
  • 1,509
  • 15
  • 34
Joal
  • 3
  • 1

3 Answers3

0

Where is the rest of the html. The footer I assume is in a container and that container has to span the height of your window using something like

min-height: 700px

then in your css you set the

display: table-cell; vertical-align: bottom;

or position: absolute; bottom: 0;

0

If I understand your question properly, you want to make your footer stick to the bottom of the page no matter the height of its contents. To achieve this you can use this CSS

html, body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -4em;
}
.footer, .push {
    height: 4em;
    color:yellow;
    text-align: center;
}

Then adjust your page to follow this HTML structure

<div class="wrapper">
    <p>Your website content here.</p>
    <div class="push"></div>
</div>
<div class="footer">
    <p>Copyright (c) 2014</p>
</div>

You also mentioned that your footer floats to one side or the othr beside other content. I am assuming this is on a multi-column layout. In which case you should utilize clear: both

.footer, .push {
    clear: both;
}
gillytech
  • 3,595
  • 2
  • 27
  • 44
0

look into the browser prefixes for your css code, and style it for each browser to prevent errors in the rendering of your html/css. Take a look at css3 schools browser support for more information, hope this helps

7888
  • 72
  • 1
  • 1
  • 6