0

footer stick at the bottom

what is the best solution to stick the footer at the bottom without it overlapping with the body content?

22nd Jun 2016, 3:29 PM
Jose Paulo Garcia
5 ответов
0
bottom of the browser window (so it floats) or bottom of your website?
22nd Jun 2016, 4:40 PM
Alex Wood
Alex Wood - avatar
0
bottom of website please
22nd Jun 2016, 6:02 PM
Jose Paulo Garcia
0
I presume you're using the footer tag. Have you tried just setting a top margin on the footer to separate it from the body?
22nd Jun 2016, 9:08 PM
Alex Wood
Alex Wood - avatar
0
i think i get it now. thanks.
22nd Jun 2016, 9:59 PM
Jose Paulo Garcia
0
Considering that your page has 3 main sections, header, main-container and footer, a good solution to have your footer always displayed at the bottom of your body content is to use display:flex on the body element and flex: 1 0 auto on main-container.. You need several CSS properties applied near the display: flex to make it work and use webkit prefixes for browser compatibility. A short example would look like this: body { display: flex; flex-direction: column; justify-content: center; } .main-container { flex: 1 0 auto; } header, footer { flex: none; } You can learn more about flexbox by checking the next url: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
26th Jun 2016, 8:55 PM
Elena Alexie
Elena Alexie - avatar