【发布时间】:2022-01-26 08:43:05
【问题描述】:
我尝试使用 flex-direction: column-reverse 进行此布局,其中按钮 1 和按钮 2 的顺序在不更改 html 的情况下交换:
<button>2</button>
<button>1</button>
但我不能应用 flex,因为它变成了 1 班轮。
.flex {
display: flex;
}
button {
width: 100%;
}
.wrap {
width: 200px;
}
<div class="wrap">
<div class="flex">
<button>2</button>
<button>1</button>
</div>
</div>
【问题讨论】:
-
弹性方向:列;然后 order:1 到按钮 1 ?
-
@TemaniAfif display flex make 2 row变成了1 row,这不是我想要的
-
您的代码没有
flex-direction: column-reverse。