I'm using a fixed footer on my webpage.
On mobile, it is fixing to the bottom of the page and covering other content.
How can I change it so that the footer is fixed only on large/desktop screens?
I'm using a fixed footer on my webpage.
On mobile, it is fixing to the bottom of the page and covering other content.
How can I change it so that the footer is fixed only on large/desktop screens?
Use media query
css for the solution.
@media (min-width:320px) { .navbar-fixed-bottom{position:relative !important;} }
@media (min-width:480px) { .navbar-fixed-bottom{position:relative !important;} }
@media (min-width:600px) { .navbar-fixed-bottom{position:relative !important;} }
Hope this answer helpful to you.
You can read about bootstrap 3 breakpoints here
Small screens are usually smaller than 768px
, so if you don't want the footer fixed on small screens. you can change the position of the footer in the small screens using the media queries.
/*for mobile phones and tablets (both)*/
@media only screen and (min-width: 320px) and (max-width: 767px) {
.navbar-fixed-bottom {
position: static !important;
}
}
/* for mobile phones only*/
@media only screen and (min-width: 320px) and (max-width: 480px) {
.navbar-fixed-bottom {
position: static !important;
}
}
Or you can see one more solution here for the same.
You can check the mobile view of the website the developer tools the browser.
Or second solution is to add padding for container on mobiles:
@media only screen and (min-width: 320px) and (max-width: 991px) {
.my_container{
padding-bottom: 100px !important; //example
}
}
Padding must have at least footer height + some px for good looking.