Reputation: 91
I just need a sticky footer for my mobile ui. (not fixed) I did a research and played with these codes.
Main div
.public-profile {
background-color: #30b29e;
max-width: 460px;
margin: 0 auto;
position: relative;
height: 100%;
}
Footer
.pulic-profile-score {
text-align: center;
background-color: #2ba08e;
padding: 15px;
color: white;
bottom: 0;
position: absolute;
}
As you can see it's not stayed at the bottom of the page. It's placing on main div bottom area and showing white space area. I'm confused. I already gave 100% height to the main div but it's not placing on bottom of the page. If I change it to fixed, it shows white gap between footer and content area. What am I missing here?
Upvotes: 0
Views: 92
Reputation: 143
On this class add these
.pulic-profile-score {
position: fixed;
min-height:10%;// 10% of the main Div
}
Upvotes: 0
Reputation: 1604
You could use position:sticky
, but be aware of it's current support. Check it out here.
Upvotes: 0