jgthms / bulma

Modern CSS framework based on Flexbox
https://bulma.io
MIT License
49.37k stars 3.95k forks source link

Support for sticky footer #47

Closed soc closed 7 years ago

soc commented 8 years ago

It would be nice if Bulma had built-in support for "sticky footers" as described in https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/.

ibrahimyu commented 8 years ago

+1 this is a must have!

jgthms commented 8 years ago

Yeah, so this requires a class on the html or body, and an additional container like .main or something. It's a tricky one because it's not a separate component but a collection of things. I might add it though.

guilhermedecampo commented 8 years ago

Any news on that?

joaoeffting commented 8 years ago

trying to do the same but not working :c

guilhermedecampo commented 8 years ago

@joaoeffting try out...

layout.jsx

<div className={styles.site}>
  <Header/>
  <main className={styles.site__content}>
    // my-content
  </main>
  <Footer />
</div>

layout.styl

.site
  display flex
  min-height 100vh
  flex-direction column

.site__content
  flex 1
evertramos commented 7 years ago

yeah.. it would be nice to have a sticky and might a always visible as well. I mean, when you have infinite scroll and still want a fixed footer in your page.

Thanks!

VizuaaLOG commented 7 years ago

There is a pull request to add this in at #366

richeklein commented 7 years ago

@guilhermedecampo solution works well. Just use a wrapper div around the content block that is just above the footer.

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

#wrapper {
  flex: 1;
}
jgillich commented 7 years ago

@jgthms I'm probably missing something, why were this and #366 closed?

benbrittain commented 7 years ago

A Sticky footer by default would still be greatly useful

toymachiner62 commented 7 years ago

@jgillich @jgthms I'm also wondering why this was closed.

edg-l commented 7 years ago
.fix-footer {
    position: absolute;
    width: 100%;
    bottom: 0;
    overflow:hidden;
}
obfusticatedcode commented 7 years ago

I'm using Bulma and echo what other people have mentioned that a sticky footer class="" would be great. I've used, this simple solution, https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ which works great.

solbreslin commented 7 years ago

+1

lobanovkirill commented 7 years ago

Please add sticky class for footer!

BenBao93 commented 7 years ago

+1

The solution mentioned by @obfusticatedcode works flawless but having it built in would be more beautiful

rvalery commented 6 years ago

+1

dikaio commented 6 years ago

+1

jgillich commented 6 years ago

Stop with the +1, they don't do anything. Use reactions.

dikaio commented 6 years ago

@jgillich. Yes, that just made an enormous difference...

jethromayuk commented 6 years ago

+1

pskarlas commented 6 years ago

This solution serves me more than well...no extra wrappers involved.

ErikThiart commented 6 years ago

Sticky Footer should be the default for Bulma, I cannot think of a reason why you would not want this behavior.

schleimschein commented 6 years ago

+1 Actually I was irritated when I discovered that this feature doesn't exist. Edit: ... because the rest of Bulma is so well built :)

diomed commented 6 years ago

@jgthms why is this, despite so much interest for it, closed and not implemented?

sergiubologa commented 6 years ago

I use a fixed navbar (.is-fixed-top) so in order to get rid of the unnecessary scrollbar I use the following solution:

body {
  display: flex;
  min-height: calc(100vh - 52px);
  flex-direction: column;
}

#wrapper {
  flex: 1;
}

where 52px is the height of the navbar.

AllanDaemon commented 6 years ago

I expected the fixed footer the be the default behavior. It seems to me that most people also expected this to be the default one, and the non-fixed one the variation.

And what is more surprising to my experience is that it isn't implemented yet. But things seem to be on the way to be fixed.

mrUlrik commented 6 years ago

@sergiubologa This doesn't seem to work across browsers. Are you having that issue?

spridev commented 6 years ago

I also use a fixed navbar, but instead of hardcoding the navbar-height (like @sergiubologa did), I used an available bulma variable:

body {
  display: flex;
  min-height: calc(100vh - #{$navbar-height});
  flex-direction: column;
}

#wrapper {
  flex: 1 0 auto;
}

I also replaced flex: 1 by flex: 1 0 auto to make it work on IE11.

mlars84 commented 6 years ago

It's not ideal, but you can also just give your footer a navbar is-fixed-bottom class. It's crazy they wouldn't just have footer is-fixed-bottom, or have is-fixed-bottom be a helper for anything.

omrico commented 6 years ago

Has anyone succeeded implementing @neovive solution with Angular 2+? I know this is a CSS related issue rather then Angular. Thanks in advance.

markand commented 6 years ago

I would like to see this as well.

ErikThiart commented 6 years ago

Just to confirm do you guys want a footer that stick to the bottom of the screen if there is not enough content, but then continue to move down as your content grows, IE NOT a stuck/pegged to the bottom footer that remains there as you scroll down or do you want a fixed footer that is at the bottom of the screen and remains there whilst you scroll down?

omrico commented 6 years ago

a footer that stick to the bottom of the screen if there is not enough content, but then continue to move down as your content grows, IE NOT a stuck/pegged to the bottom footer that remains there as you scroll down.

That one ☝️

mlars84 commented 6 years ago

Yep. "a footer that stick to the bottom of the screen if there is not enough content, but then continue to move down as your content grows, IE NOT a stuck/pegged to the bottom footer that remains there as you scroll down"

Warix3 commented 6 years ago

Bulma would've been better with this as a default. I've used https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ and it works fine. Sure it would add some extra classes and elements that need to be used, but at least give us an option to do that. It doesn't have to be the default but it would definitely improve bulma if it becomes an option.

joaopgrassi commented 6 years ago

I've been banging my head trying to implement the solution proposed by OP in an Angular CLI app for a couple of hours. So, I followed the approach there and added the class in the body and in a wrapper div. In my case, around router-outlet where my content is loaded:

index.html

 <!-- omitted header for brevity -->
<body class="Site">
  <app-root></app-root>
</body>
</html>

app.component.html

<div class="Site-content">
    <router-outlet></router-outlet>
</div>
<footer class="footer">
    Footer here
</footer>

And it doesn't work! Tried everything. Almost giving up, I tried one last thing: I added the class to the app-root instead and it worked!

 <!-- omitted header for brevity -->
<body>
  <app-root class="Site"></app-root>
</body>
</html>

Not sure why it was not working on body... but my best guess is that the Site and Site-content classes have to be direct siblings? (not even sure if this is the correct term). When I had the Site class in the body, the<app-root> was in between the wrapper div that contained the Site-content. Might be obvious or a silly mistake on my side, but I thought it would help others putting this here.

shepherdjerred commented 6 years ago

Using bulma with react, this solution worked perfectly fine for me without any other work

https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/

My root component looks like this

ReactDOM.render((
  <Provider store={store}>
    <HashRouter>
      <div className='site'>
        <ReduxNavigation />
        <div className='site-content'>
          <ReduxRouter />
        </div>
        <Footer />
      </div>
    </HashRouter>
  </Provider>
), document.getElementById('root'));
MrJacz commented 6 years ago

@jgthms Please reopen this issue and reconsider implementation because I've been looking for a working solution for the last 12 hours and Haven't found anything that works as intended... this is something that has a lot of interest and should not be put to the side. even if you make an extension for it, it would be so f***ing helpful you don't understand!

JamesTheHacker commented 6 years ago

Still not implemented?! It's not even hard to implement and so many people have requested their support for this. I start to lose faith in a library when it fails to keep up to conventions and its community.

ghost commented 6 years ago

I'm going to also vote on this. It seems that it exists the ability to actually fix this issue. @jgthms if there is something very specific you want help with to get this done let us know as a community we'd all be glad to help.

JamesTheHacker commented 6 years ago

I feel like a right plank. It's been in the documentation all along .is-fixed-bottom.

https://bulma.io/documentation/components/navbar/#fixed-navbar

🤦‍♂️

I checked out what is-fixed-bottom and it does exactly the following except I've modified it for sticky footers.

footer {
  bottom: 0;
  left: 0;
  position: fixed;
  right: 0;
  z-index: 30;
}

K.I.S.S 😉

Warix3 commented 6 years ago

@JamesTheHacker It's not the same as sticky footer described in the issue. Take a look here: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ Sticky footer stays always on bottom of the web page and not on bottom of the screen, unless there is not enough content, then it's both on bottom of the screen and on bottom of the page. And of course when you scroll down to the bottom. Unlike fixed navbar which is always on bottom of the screen regardless of content and scrolling.

JamesTheHacker commented 6 years ago

@Warix3 I see.

rmuchall commented 6 years ago

@jgthms Would it be possible to reopen this issue? :)

Thanks!

niconisoria commented 6 years ago

Reopen this issue again please!

nullbio commented 6 years ago

I too am seeking the holy sticky footer.

Clauber commented 5 years ago

Nothing yet?

cameronb23 commented 5 years ago

Would be a great addition for (clearly) many of us. Just hoping the issue gets reopened 👍

kimbaudi commented 5 years ago

I want my sticky footer to work whether or not my navbar is fixed (to the top or bottom). So I ended up combining the solutions provided by @guilhermedecampo and @iSpri.

body {
  &.default {
    display: flex;
    // use this if navbar is NOT fixed (default)
    min-height: 100vh;
    flex-direction: column;
  }
  &.fixed {
    display: flex;
    // use this if navbar is fixed
    min-height: calc(100vh - #{$navbar-height});
    flex-direction: column;
  }
}

Now I add <body class="default"> when I'm using a regular navbar and I add <body class="fixed"> when I'm using a fixed navbar. Now I get sticky footer when my navbar is fixed and also when its not! 😄