Flex:纵向卡片底部操作对齐 | 星雨笔录

将卡片按钮固定对齐到底部。

核心: 卡片纵向 flex-direction:column,底部按钮 margin-top:auto,保证各卡片按钮对齐。

最小示例:

.card { display: flex; flex-direction: column; }
.card button { margin-top: auto; }

学完能做: 将卡片按钮固定对齐到底部。