flexbox sticky footer

丶灬走出姿态 提交于 2019-12-08 14:24:23

Add display: flex to .card.

That will allow the children to use the full height of .container.

It will also pin the footer to the bottom.

revised demo


For a more comprehensive fix (if necessary), you will need to switch the flex-direction of .container-inner to column, and make adjustments to the flex items to account for this switch.

revised demo


The reason why align-self: flex-end and margin-top: auto didn't work has to do with the flex lines in a multi-line flex container.

Essentially, because of the way align-content works, your footer cannot break out of its flex line and shift to the bottom of the container.

For a complete explanation, see this post:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!