-1

My css for footer

.my_footer {
    background-color:#00FFFF;
    height: 60px;
}

.my_footer p {
    padding-top:20px;
    font-size:14px;
    font-color:#191970;
}

On my first page of html, footer position is at the bottom which is normal. But when I go to the next pages, the position of the footer changes. I have tried fixed-bottom, but that is nothing works for me

My footer.html:

<footer>
    <div class=" footer navbar-fixed-bottom my_footer">
        <p class="text-center">&copy; A&A shop pvt ltd.All rights Reserved</p>
    </div>
</footer>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

3 Answers3

0

if you want your footer to fixed at bottom then

element{
   position: fixed;
   left: 0;
   bottom: 0;
}

or if you want your footer to fixed at bottom and also stay at bottom on scroll then

element{
  position: sticky;
  bottom: 0;
}
shoaib sabir
  • 605
  • 2
  • 9
  • 23
0

SOLUTION 1:

USING FLEXBOX

Give the body (or whatever you have as a container of the page) a display:flex and flex-direction:column so they go under each other, then give it margin-top:auto or justify-self:flex-end, both of these works perfectly for me.

body {
    display:flex;
    flex-direction:column;
}
footer {
    margin-top:auto;
    /*OR*/
    justify-self:flex-end;
}

SOLUTION 2:

USING POSITION ABSOLUTE

The second solution is with position:absolute

Live Preview

footer {
   position:absolute;
   bottom: 0;
}
Mr-montasir
  • 132
  • 1
  • 1
  • 8
0

You can try using this CSS.

    .my_footer {
        position: fixed;
        width: 100%;
        bottom: 0;
        left: 0;
    }