CSS, Web, Web Development, Layout.
to achieve the same effect: body { display: flex; flex-direction: column; } main { flex: 1 0 auto; } The effect is as follows: <main> in the flex: 1 0 auto is equivalent to: main { flex-grow: 1; /*容器有剩余空间时，main区域会扩展*/ flex-shrink: 0; /*容器有不足空间时，main区域不会收缩*/ flex-basis: auto;