Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I have a problem with my footer.

Because there is a lack of content on some pages, the footer wouldn't stick to the bottom.

I fixed this by adding the bootstrap class "fixed-bottom".

It worked!

But now the problem is that, on mobile devices, the footer is hiding half of the page's content.

I inspected it on Chrome Developer tools and saw that, when I remove the fixed-bottom class from the footer, the footer no longer hides the content!

What I have tried:

I tried adding a media query of the footer WITHOUT the class "fixed-bottom" - basically the identical footer, but without the class.

@media only screen and (max-width: 600px) {
    <footer style="background-color: orange;">
        <div class="container-fluid">
            <br />
            class="fa fa-facebook fa-3x"__^
            ^__i class="fa fa-instagram fa-3x">
            ^__i class="fa fa-linkedin fa-3x">
        </div>
        <br />
        <div class="container-fluid">
            <p>^__i class="fa fa-copyright"> Veselin Dimitrov's Weather App</p>
        </div>
    </footer>
  }


But it doesn't seem to be removing the content.

All I need to do is remove the footer on smaller devices and it's sorted!
Posted
Updated 14-Jun-20 12:17pm

1 solution

Short answer: The media query goes in CSS not HTML.

If you just want to remove the footer on smaller screens, create a CSS class, say, hide-footer with something like
@media screen (max-width: 600px) {display:none}

then your footer HTML would be

<footer class="fixed-bottom hide-footer"> ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900