- This topic is empty.
-
AuthorPosts
-
January 21, 2016 at 5:31 am #237117
Historical Forums User
ParticipantThe title is pretty self-explanatory and this will (hopefully) be a pretty easy fix, but I’m just not able to figure it out by myself.
The footer should stick to the bottom of the yellow div. If you slide down some of those menus and there’s not enough vertical space the footer should move down with the content and stop being visible unless, of course, you scroll down.
Thanks.
January 21, 2016 at 6:03 am #237120Paulie_D
MemberYour Codepen doesn’t seem to show the issue..did you forget some javascript or something?
Regardless, these are several “sticky footer” options you can find with a quick Google Search.
January 21, 2016 at 6:15 am #237121Historical Forums User
ParticipantIt does show. The footer (© 2016 Lorem ipsum.) should be at the bottom of the yellow div, not near the red text.
I know there are. I googled and tried several different methods, unfortunately never quite got it right.
January 21, 2016 at 8:22 am #237125Paulie_D
MemberI googled and tried several different methods, unfortunately never quite got it right.
Well perhaps you could show us oen of those attempts?
January 21, 2016 at 8:35 am #237126bearhead
ParticipantIs this what you’re looking for?
http://codepen.io/kvana/pen/vLpaZPI wrapped all of the content before the footer in a div, then applied the following css:
.wrapper { min-height: 100%; margin-bottom: -16px; /*negative footer height*/ } .wrapper:after { content: ""; display: block; } .footer, .wrapper:after { height: 16px; }
This method does require you to have a set footer height…
January 21, 2016 at 10:35 am #237131Historical Forums User
ParticipantThat’s actually the first method I tried, but it changed nothing!
It still looks like this
When it should look like this
January 21, 2016 at 10:56 am #237132bearhead
ParticipantDid you take a look at my pen? At least on Chrome it has the copyright line at the bottom like you wanted…
Maybe you just didn’t implement the sticky footer correctly?
January 21, 2016 at 11:25 am #237133Historical Forums User
ParticipantYes, that first screen shot is from your pen and as you can see the footer did not move. I’m on Safari, but that shouldn’t mess anything up, right? At least I haven’t ready anything about it not working on Safari…
January 21, 2016 at 12:11 pm #237135bearhead
Participanthmm, I guess that method doesn’t work in firefox/safari unless the footer and page wrap are direct children of the body… weird :|
I tested it out with the css tricks example, and experienced the same issue as with your page.
I guess my advise would be to see if you can re-write the html and css such that the footer and page wrap are direct children of the body.
oh, you’ll also have to add
body, html{ height:100%; }
January 21, 2016 at 12:31 pm #237137Historical Forums User
ParticipantI don’t see how I could do that.
The footer’s gotta be inside the page wrap, hasn’t it?January 21, 2016 at 12:42 pm #237138bearhead
ParticipantNo, in the example I gave the page wrap and footer should be siblings that are a direct child of the body.
But I’ve been looking at your pen a little more closely, and I think the
flexcroll
class is causing some conflict… the yellow div is positioned absolutely, so you should be able to keep the footer at the bottom of it with:.footer{
position:absolute;
bottom:0;
}and letting the yellow div have a height of auto, so that it expands with the content.
However, the flexcroll class seems to be applying a set height to the div.Here is an example without the flexcroll class:
http://codepen.io/kvana/pen/qbpLNzAlso, the sub groups are expanding but not contacting in Chrome for some reason :|
January 21, 2016 at 12:48 pm #237139Historical Forums User
ParticipantSorry, but that is definitely a no-go!
The yellow div gotta have that exact size. It can not grow as you expand the content.January 22, 2016 at 2:52 am #237145Historical Forums User
ParticipantHey Bearhead, have you updated your first codepen?
The one from this post?
https://css-tricks.com/forums/topic/how-to-stick-footer-to-the-bottom/#post-237126January 22, 2016 at 3:56 am #237148Paulie_D
MemberFlexbox can do that depending on what browser support you need.
January 22, 2016 at 5:32 am #237153Historical Forums User
ParticipantShould Safari not be supported?
http://caniuse.com/#feat=flexboxI run your pen and it still looks like this
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.