M
M
Maxim Kapralov2014-08-26 08:31:30
css
Maxim Kapralov, 2014-08-26 08:31:30

Footer with flexbox?

Hello! Tell me, who can, what is the problem. I made the footer stick to the bottom of the page using flexbox:

body{
  display: flex;
  height: 100vh;
  flex-direction: column;
}
.layout {
  width: 100%;
  flex: 1 0 auto;
}
footer{
  width: 100%;
  height: 150px;
}

In the markup, respectively, the layout and footer are located next to each other. If the layout is empty or no height is specified for it, then the footer stands still, pressed to the bottom of the page. But as soon as you add content, the footer (the block itself, with the background and others) goes down outside the viewport, and all the contents of the footer remain in place.
Upd. When zoomed out to 50% or less, the footer appears in place.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Kapralov, 2014-08-26
@Byrnane

I found a mistake - in the body you need to specify min-height: 100vh instead of height
And a new question - how to make it work in IE? :)
In it, flexboxes conflict with min-height...
Maybe someone knows?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question